Upload beautify
This commit is contained in:
21
app/Repositories/Uploads/AuditLogRepository.php
Normal file
21
app/Repositories/Uploads/AuditLogRepository.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repositories\Uploads;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
final class AuditLogRepository
|
||||
{
|
||||
public function log(?int $userId, string $action, string $ip, array $meta = []): void
|
||||
{
|
||||
DB::table('audit_logs')->insert([
|
||||
'user_id' => $userId,
|
||||
'action' => $action,
|
||||
'ip' => $ip,
|
||||
'meta' => empty($meta) ? null : json_encode($meta, JSON_THROW_ON_ERROR),
|
||||
'created_at' => now()->toDateTimeString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user