Manage

Audit trail

@php $filtered = collect($filters)->filter()->isNotEmpty(); $show = fn ($v) => Str::limit(match (true) { $v === null, $v === '' => 'empty', is_bool($v) => $v ? 'yes' : 'no', is_scalar($v) => (string) $v, default => json_encode($v, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) }, 60); @endphp
@if ($filtered) Clear @endif
@if ($logs->isEmpty())

{{ $filtered ? 'No activity matches these filters.' : 'No activity recorded yet.' }}

@if ($filtered) Clear filters @endif
@else
@foreach ($logs as $log) @endforeach
When User Action Record IP
{{ $log->created_at->format('j M Y') }} {{ $log->created_at->format('g:i:s a') }} @if ($log->user) {{ $log->user->name }} {{ $log->user->staff_id }} @else System @endif in_array($log->action, ['deleted', 'login_failed']), 'text-brand' => $log->action === 'created', 'text-slate-700' => ! in_array($log->action, ['deleted', 'login_failed', 'created'])])> {{ $actions[$log->action] ?? $log->action }} {{ $log->description }} @if ($log->changes)
{{ count($log->changes) }} {{ Str::plural('field', count($log->changes)) }} changed
@foreach ($log->changes as $field => $change)
{{ Str::headline($field) }}
{{ $show($change['from']) }} to {{ $show($change['to']) }}
@endforeach
@endif
{{ $log->ip ?? '—' }}
{{ $logs->links() }}
@endif