ldc-tregalette/app/Traits/Models/ActivityLog.php

26 lines
557 B
PHP
Raw Permalink Normal View History

2023-12-15 15:53:55 +00:00
<?php
namespace App\Traits\Models;
use App\Observers\ModelObserver;
/**
* If there is a static function in a trait (named boot[TraitName]),
* it will be executed as the boot() function would on an Eloquent model.
* Futhermore, event in the Model observer doesn't erase actual events in the model,
* but adds them.
*/
trait ActivityLog
{
/**
*
* @return void
*/
public static function bootActivityLog(): void
{
static::whenBooted(function () {
static::observe(ModelObserver::class);
});
2023-12-15 15:53:55 +00:00
}
}