belongsToMany(Technique::class, 'technique_chapter', 'parent_id', 'child_id') ->withPivot('level', 'order') ->orderByPivot('order') ->using(TechniqueChapter::class); } protected $casts = [ 'index' => 'boolean', ]; }