Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ActivityLog | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| bootActivityLog | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Traits\Models; |
| 4 | |
| 5 | use App\Observers\ModelObserver; |
| 6 | |
| 7 | /** |
| 8 | * If there is a static function in a trait (named boot[TraitName]), |
| 9 | * it will be executed as the boot() function would on an Eloquent model. |
| 10 | * Futhermore, event in the Model observer doesn't erase actual events in the model, |
| 11 | * but adds them. |
| 12 | */ |
| 13 | trait ActivityLog |
| 14 | { |
| 15 | /** |
| 16 | * |
| 17 | * @return void |
| 18 | */ |
| 19 | public static function bootActivityLog(): void |
| 20 | { |
| 21 | static::observe(ModelObserver::class); |
| 22 | } |
| 23 | } |