1 | <?php |
||
8 | trait CascadeSoftDeletes |
||
9 | { |
||
10 | /** |
||
11 | * Boot the trait. |
||
12 | * |
||
13 | * Listen for the deleting event of a soft deleting model, and run |
||
14 | * the delete operation for any configured relationship methods. |
||
15 | * |
||
16 | * @throws \RuntimeException |
||
17 | */ |
||
18 | 4 | protected static function bootCascadeSoftDeletes() |
|
41 | |||
42 | |||
43 | /** |
||
44 | * Determine if the current model implements soft deletes. |
||
45 | * |
||
46 | * @return bool |
||
47 | */ |
||
48 | 4 | protected function implementsSoftDeletes() |
|
52 | |||
53 | |||
54 | /** |
||
55 | * Determine if the current model has any invalid cascading relationships defined. |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | protected function hasInvalidCascadingRelationships() |
||
65 | } |
||
66 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: