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