21 lines
505 B
PHP
21 lines
505 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\AuditLog;
|
|
|
|
class AuditLogger
|
|
{
|
|
public function log(?int $eventId, ?int $actorUserId, string $action, ?string $entityType=null, ?int $entityId=null, array $meta=[]): void
|
|
{
|
|
AuditLog::create([
|
|
'event_id' => $eventId,
|
|
'actor_user_id' => $actorUserId,
|
|
'action' => $action,
|
|
'entity_type' => $entityType,
|
|
'entity_id' => $entityId,
|
|
'meta' => $meta ?: null,
|
|
]);
|
|
}
|
|
}
|