Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | protected static function bootValidatable() |
||
17 | { |
||
18 | // Hook to execute before creating |
||
19 | static::creating(function (Model $model) { |
||
20 | $model->validate(); |
||
21 | }); |
||
22 | |||
23 | // Hook to execute before updating |
||
24 | static::updating(function (Model $model) { |
||
25 | $model->validate(); |
||
26 | }); |
||
27 | } |
||
28 | |||
62 | } |
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: