@extends('admin.layout') @section('title', 'Audit Logs') @section('content')
Audit Logs
{{ $logs->total() }} events found @if(request()->hasAny(['action','user','ip','subject','date_from','date_to'])) — clear filters @endif
{{-- Filters --}}
{{-- Table --}}
@if($logs->isEmpty())
No audit events found.
@else @foreach($logs as $log) @php $severity = $log->severity; $icon = match($severity) { 'danger' => 'bi-trash3-fill', 'warning' => 'bi-exclamation-triangle-fill', 'success' => 'bi-cloud-upload-fill', 'info' => 'bi-box-arrow-in-right', 'purple' => 'bi-shield-lock-fill', 'orange' => 'bi-person-badge-fill', 'muted' => 'bi-box-arrow-right', default => 'bi-dot', }; $ua = $log->user_agent ?? ''; $device = match(true) { str_contains($ua, 'Mobile') || str_contains($ua, 'Android') => '📱 Mobile', str_contains($ua, 'Tablet') || str_contains($ua, 'iPad') => '📟 Tablet', default => '🖥️ Desktop', }; $browser = match(true) { str_contains($ua, 'Firefox') => 'Firefox', str_contains($ua, 'Chrome') && !str_contains($ua, 'Chromium') && !str_contains($ua, 'Edg') => 'Chrome', str_contains($ua, 'Safari') && !str_contains($ua, 'Chrome') => 'Safari', str_contains($ua, 'Edg') => 'Edge', str_contains($ua, 'curl') => 'cURL', default => 'Unknown', }; @endphp @if($log->details) @endif @endforeach
Time Action User Subject IP Address Device
{{ $log->created_at->format('d M Y') }}
{{ $log->created_at->format('H:i:s') }}
{{ $log->created_at->diffForHumans() }}
{{ $log->action_label }}
@if($log->user) @else
@endif
@if($log->user) {{ $log->user_name ?? 'Unknown' }} @else {{ $log->user_name ?? ($log->action === 'user.login.failed' ? 'Guest' : 'Unknown') }} @endif
@if($log->user_id)
#{{ $log->user_id }}
@endif
@if($log->subject_label)
@if($log->subject_type === 'Video' && $log->subject_id) {{ $log->subject_label }} @elseif($log->subject_type === 'User' && $log->subject_id) {{ $log->subject_label }} @else {{ $log->subject_label }} @endif
{{ $log->subject_type }}
@else @endif
@if($log->ip_address) {{ $log->ip_address }} @else @endif
{{ $device }} · {{ $browser }} @if($log->details) @endif
{{-- Pagination --}} @if($logs->hasPages())
Showing {{ $logs->firstItem() }}–{{ $logs->lastItem() }} of {{ $logs->total() }} events
@endif @endif
@endsection