class Technique extends Model
{
use HasFactory;
+
+ public function chapters() {
+ return $this
+ ->belongsToMany(Technique::class, 'technique_chapter', 'parent_id', 'child_id')
+ ->withPivot('level', 'order')
+ ->orderByPivot('order')
+ ->using(TechniqueChapter::class);
+ }
+
+ protected $casts = [
+ 'index' => 'boolean',
+ ];
}