Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | protected static function bootDetectsChanges() |
||
15 | { |
||
16 | collect(['updating', 'deleting'])->each(function ($eventName) { |
||
17 | |||
18 | return static::$eventName(function (Model $model) { |
||
19 | |||
20 | $model->oldValues = $model->fresh()->toArray(); |
||
21 | |||
22 | $model->newValues = $model->getDirty(); |
||
23 | |||
24 | }); |
||
25 | }); |
||
26 | } |
||
27 | |||
52 |
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: