]> git.localhorst.tv Git - alttp.git/blob - app/Models/Technique.php
technique chapters
[alttp.git] / app / Models / Technique.php
1 <?php
2
3 namespace App\Models;
4
5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model;
7
8 class Technique extends Model
9 {
10         use HasFactory;
11
12         public function chapters() {
13                 return $this
14                         ->belongsToMany(Technique::class, 'technique_chapter', 'parent_id', 'child_id')
15                         ->withPivot('level', 'order')
16                         ->orderByPivot('order')
17                         ->using(TechniqueChapter::class);
18         }
19
20         protected $casts = [
21                 'index' => 'boolean',
22         ];
23 }