| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | trait HandlesRelation |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @return mixed |
||
| 12 | */ |
||
| 13 | public function relation() |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Finds a module this relation belongs to. |
||
| 20 | * |
||
| 21 | * @return null| |
||
| 22 | */ |
||
| 23 | public function relationModule(): ?Module |
||
| 24 | { |
||
| 25 | return Architect::resourceByEntity( |
||
| 26 | $this->relation()->getRelated() |
||
| 27 | ); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param $relation |
||
| 32 | * @return mixed |
||
| 33 | */ |
||
| 34 | public function getForeignKey($relation) |
||
| 45 | } |
||
| 46 | } |
||
| 47 |