| Conditions | 3 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public function depthRelatedTo(Model $model) |
||
| 31 | { |
||
| 32 | if (!$this->relationLoaded('ancestors')) { |
||
| 33 | $this->load('ancestors'); |
||
| 34 | } |
||
| 35 | |||
| 36 | $index = $this->ancestors->search(function ($ancestor) use ($model) { |
||
| 37 | return $ancestor->getKey() === $model->getKey(); |
||
| 38 | }); |
||
| 39 | |||
| 40 | return $index !== false ? $index + 1 : null; |
||
| 41 | } |
||
| 43 |