Conditions | 5 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Anomaly\Streams\Platform\Model\Command; |
||
36 | public function handle() |
||
37 | { |
||
38 | foreach ($this->model->getCascades() as $relation => $actions) { |
||
39 | if (in_array('restore', $actions)) { |
||
40 | |||
41 | $relation = $this->model |
||
42 | ->{camel_case($relation)}() |
||
43 | ->onlyTrashed() |
||
44 | ->getResults(); |
||
45 | |||
46 | if ($relation instanceof EloquentModel) { |
||
47 | $relation->restore(); |
||
|
|||
48 | } |
||
49 | |||
50 | if ($relation instanceof EloquentCollection) { |
||
51 | $relation->each( |
||
52 | function (EloquentModel $item) { |
||
53 | $item->restore(); |
||
54 | } |
||
55 | ); |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | } |
||
61 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: