1 | <?php |
||
9 | trait CascadeSoftDeletes |
||
10 | { |
||
11 | /** |
||
12 | * Boot the trait. |
||
13 | * |
||
14 | * Listen for the deleting event of a soft deleting model, and run |
||
15 | * the delete operation for any configured relationship methods. |
||
16 | * |
||
17 | * @throws \LogicException |
||
18 | */ |
||
19 | 10 | protected static function bootCascadeSoftDeletes() |
|
55 | |||
56 | |||
57 | /** |
||
58 | * Determine if the current model implements soft deletes. |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | 10 | protected function implementsSoftDeletes() |
|
66 | |||
67 | |||
68 | /** |
||
69 | * Determine if the current model has any invalid cascading relationships defined. |
||
70 | * |
||
71 | * A relationship is considered invalid when the method does not exist, or the relationship |
||
72 | * method does not return an instance of Illuminate\Database\Eloquent\Relations\Relation. |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | 9 | protected function hasInvalidCascadingRelationships() |
|
82 | |||
83 | |||
84 | /** |
||
85 | * Fetch the defined cascading soft deletes for this model. |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | 9 | protected function getCascadingDeletes() |
|
93 | |||
94 | |||
95 | /** |
||
96 | * For the cascading deletes defined on the model, return only those that are not null. |
||
97 | * |
||
98 | * @return array |
||
99 | */ |
||
100 | protected function getActiveCascadingDeletes() |
||
106 | } |
||
107 |