]> git.localhorst.tv Git - alttp.git/blob - app/Models/Technique.php
technique translations
[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         public function translations() {
21                 return $this->hasMany(TechniqueTranslation::class);
22         }
23
24         protected $casts = [
25                 'index' => 'boolean',
26         ];
27
28         protected $with = [
29                 'translations',
30         ];
31
32 }