]> git.localhorst.tv Git - alttp.git/blobdiff - app/Models/Technique.php
technique chapters
[alttp.git] / app / Models / Technique.php
index 202c455945736ae2107ff21bbd4ce594ade2ccaa..1a54a0e1b29767f6f7ce29d1efc485ec1b17328d 100644 (file)
@@ -8,4 +8,16 @@ use Illuminate\Database\Eloquent\Model;
 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',
+       ];
 }