Total Complexity | 3 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait Predicates |
||
6 | { |
||
7 | /** |
||
8 | * Determine if the model has a parent |
||
9 | * |
||
10 | * @return bool |
||
11 | */ |
||
12 | public function hasParent() |
||
13 | { |
||
14 | return $this->{$this->getParentKeyName()} !== null; |
||
|
|||
15 | } |
||
16 | |||
17 | /** |
||
18 | * Determine if the model is a child |
||
19 | * |
||
20 | * @return bool |
||
21 | */ |
||
22 | public function isChild() |
||
23 | { |
||
24 | return $this->hasParent(); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Determine if the model is root |
||
29 | * |
||
30 | * @return bool |
||
31 | */ |
||
32 | public function isRoot() |
||
35 | } |
||
36 | } |