| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | trait HasRecursiveRelationshipHelpers |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Determine if the model is a child of the given model. |
||
| 11 | * |
||
| 12 | * @param \Illuminate\Database\Eloquent\Model $model |
||
| 13 | * @return bool |
||
| 14 | */ |
||
| 15 | public function isChildOf(Model $model): bool |
||
| 16 | { |
||
| 17 | return $this->parent ? $this->parent->is($model) : false; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Determine if the model is the parent of the given model. |
||
| 22 | * |
||
| 23 | * @param \Illuminate\Database\Eloquent\Model $model |
||
| 24 | * @return bool |
||
| 25 | */ |
||
| 26 | public function isParentOf(Model $model): bool |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get the depth of the model related to the given model. |
||
| 33 | * |
||
| 34 | * @param \Illuminate\Database\Eloquent\Model $model |
||
| 35 | * @return int|null |
||
| 36 | */ |
||
| 37 | public function getDepthRelatedTo(Model $model): ?int |
||
| 51 |