You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.2 KiB
42 lines
1.2 KiB
<?php |
|
|
|
namespace App\Http\Controllers; |
|
|
|
use App\Services\AuditLogService; |
|
use Illuminate\Http\Request; |
|
use Illuminate\View\View; |
|
|
|
class AuditLogController extends Controller |
|
{ |
|
public function __construct( |
|
private readonly AuditLogService $audit |
|
) { |
|
} |
|
|
|
public function index(Request $request): View |
|
{ |
|
$search = $request->string('q')->trim()->toString(); |
|
$actorType = $request->string('type')->trim()->toString(); |
|
$module = $request->string('module')->trim()->toString(); |
|
$ipScope = $request->string('ip_scope')->trim()->toString(); |
|
|
|
$result = $this->audit->listRecent( |
|
300, |
|
$search, |
|
$actorType !== '' ? $actorType : null, |
|
$module !== '' ? $module : null, |
|
$ipScope !== '' ? $ipScope : null |
|
); |
|
|
|
return view('audit-logs.index', [ |
|
'logs' => $result['rows'], |
|
'error' => $result['error'], |
|
'search' => $search, |
|
'actorType' => $actorType, |
|
'module' => $module, |
|
'ipScope' => $ipScope, |
|
'available' => $this->audit->isAvailable(), |
|
'uiStats' => $this->audit->uiAccessStats(7, 12), |
|
]); |
|
} |
|
}
|
|
|