<?php

namespace App\Traits;

use App\Models\ActivityLog;

trait LogsActivity
{
    public static function bootLogsActivity(): void
    {
        static::created(function ($model) {
            ActivityLog::record('created', $model);
        });

        static::updated(function ($model) {
            ActivityLog::record('updated', $model, $model->getDirty());
        });

        static::deleted(function ($model) {
            ActivityLog::record('deleted', $model);
        });
    }
}
