Total Complexity | 4 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | trait TranslationTrait |
||
6 | { |
||
7 | /** |
||
8 | * The belongsTo locale relationship. |
||
9 | * |
||
10 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
11 | */ |
||
12 | abstract public function locale(); |
||
13 | |||
14 | /** |
||
15 | * The belongsTo parent relationship. |
||
16 | * |
||
17 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
18 | */ |
||
19 | abstract public function parent(); |
||
20 | |||
21 | /** |
||
22 | * Returns true/false if the current translation |
||
23 | * record is the parent translation. |
||
24 | * |
||
25 | * @return bool |
||
26 | */ |
||
27 | public function isParent() |
||
28 | { |
||
29 | if (!$this->getAttribute($this->getForeignKey())) { |
||
30 | return true; |
||
31 | } |
||
32 | |||
33 | return false; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Returns the translations of the current |
||
38 | * translation record. |
||
39 | * |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function getTranslations() |
||
49 | } |
||
50 | } |
||
51 |