adds logging and policies

This commit is contained in:
2026-02-03 11:47:08 +01:00
parent 9583b7030c
commit c693cde038
23 changed files with 2151 additions and 16 deletions

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace App\Services;
use App\Models\Log;
final class ActivityLogger
{
/**
* Log an activity to the database.
*/
public static function log(
string $action,
?int $userId = null,
?int $sessionId = null,
?int $categoryId = null,
?array $metadata = null,
): void {
Log::create([
'user_id' => $userId,
'session_id' => $sessionId,
'category_id' => $categoryId,
'action' => $action,
'metadata' => $metadata,
]);
}
}