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() |
|
50 | |||
51 | |||
52 | /** |
||
53 | * Determine if the current model implements soft deletes. |
||
54 | * |
||
55 | * @return bool |
||
56 | */ |
||
57 | 10 | protected function implementsSoftDeletes() |
|
61 | |||
62 | |||
63 | /** |
||
64 | * Determine if the current model has any invalid cascading relationships defined. |
||
65 | * |
||
66 | * A relationship is considered invalid when the method does not exist, or the relationship |
||
67 | * method does not return an instance of Illuminate\Database\Eloquent\Relations\Relation. |
||
68 | * |
||
69 | * @return array |
||
70 | */ |
||
71 | 9 | protected function hasInvalidCascadingRelationships() |
|
77 | |||
78 | |||
79 | /** |
||
80 | * Fetch the defined cascading soft deletes for this model. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 9 | protected function getCascadingDeletes() |
|
88 | |||
89 | |||
90 | /** |
||
91 | * For the cascading deletes defined on the model, return only those that are not null. |
||
92 | * |
||
93 | * @return array |
||
94 | */ |
||
95 | private function getActiveCascadingDeletes() |
||
101 | } |
||
102 |