ldc-gen-game-web/app/Traits/Models/HasActivityLog.php

22 lines
489 B
PHP
Raw Permalink Normal View History

2023-11-23 17:31:28 +01:00
<?php
2026-10-02 12:09:46 +02:00
declare(strict_types=1);
2023-11-23 17:31:28 +01:00
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.
*/
2026-10-02 12:09:46 +02:00
trait HasActivityLog
2023-11-23 17:31:28 +01:00
{
2026-10-02 12:09:46 +02:00
public static function bootHasActivityLog(): void
2023-11-23 17:31:28 +01:00
{
static::observe(ModelObserver::class);
}
}