Total Complexity | 8 |
Total Lines | 88 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Character extends Model |
||
8 | { |
||
9 | protected $table = 'characters'; |
||
10 | |||
11 | /** |
||
12 | * All of the relationships to be touched. |
||
13 | * |
||
14 | * @var array |
||
15 | */ |
||
16 | protected $touches = ['location']; |
||
17 | |||
18 | protected $fillable = [ |
||
19 | 'id', |
||
20 | 'name', |
||
21 | 'surname', |
||
22 | 'alive', |
||
23 | 'age', |
||
24 | 'en', |
||
25 | 'de', |
||
26 | 'nl', |
||
27 | 'traits', |
||
28 | 'location_id', |
||
29 | 'residence_id', |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * Get the last known residence of the character. |
||
34 | */ |
||
35 | public function location() |
||
36 | { |
||
37 | return $this->belongsTo(Location::class); |
||
38 | } |
||
39 | |||
40 | public function leads() |
||
41 | { |
||
42 | return $this->hasOne(Location::class, 'led_by'); |
||
43 | } |
||
44 | |||
45 | public function residence() |
||
46 | { |
||
47 | return $this->belongsTo(Location::class, 'residence_id'); |
||
48 | } |
||
49 | |||
50 | public function parents() |
||
51 | { |
||
52 | return $this->belongsToMany( |
||
53 | Character::class, |
||
54 | 'children', |
||
55 | '_to', |
||
56 | '_from', |
||
57 | '_id', |
||
58 | '_id', |
||
59 | ); |
||
60 | } |
||
61 | |||
62 | public function children() |
||
63 | { |
||
64 | return $this->belongsToMany( |
||
65 | Character::class, |
||
66 | 'children', |
||
67 | '_from', |
||
68 | '_to', |
||
69 | '_id', |
||
70 | '_id', |
||
71 | )->using('TestSetup\Models\Child') |
||
72 | ->withPivot([ |
||
73 | 'created_by', |
||
74 | 'updated_by', |
||
75 | ]); |
||
76 | } |
||
77 | |||
78 | public function captured() |
||
81 | } |
||
82 | |||
83 | public function conquered() |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * Get all of the tags for the post. |
||
90 | */ |
||
91 | public function tags() |
||
95 | } |
||
96 | } |
||
97 |