Add all files
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Others\ComplianceTools\Services;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Paymenter\Extensions\Others\ComplianceTools\Models\AuditLog;
|
||||
|
||||
class AuditLogService
|
||||
{
|
||||
public static function record(
|
||||
string $category,
|
||||
string $event,
|
||||
array $context = [],
|
||||
?User $subject = null,
|
||||
Authenticatable|User|null $actor = null
|
||||
): AuditLog {
|
||||
$actor ??= Auth::user();
|
||||
|
||||
return AuditLog::create([
|
||||
'category' => $category,
|
||||
'event' => $event,
|
||||
'subject_user_id' => $subject?->getKey(),
|
||||
'actor_type' => $actor?->getMorphClass(),
|
||||
'actor_id' => $actor?->getAuthIdentifier(),
|
||||
'ip_address' => request()->ip(),
|
||||
'context' => $context,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user