@extends('layouts.portal') @section('title', 'Audit Logs') @section('page_title', 'Audit Logs') @section('page_subtitle', 'System activity and security logs') @section('sidebar') @include('admin.partials.sidebar', ['active' => 'audit']) @endsection @section('content')

System Audit Logs

Export CSV
@if($logs->count() > 0)
@foreach($logs as $log) @endforeach
Timestamp User Action Description Entity IP Address
{{ $log->created_at->format('d M Y H:i:s') }}

{{ $log->user?->name ?? 'System' }}

{{ $log->user?->role ?? 'N/A' }}

@php $actionColors = [ 'created' => 'bg-green-100 text-green-800', 'updated' => 'bg-yellow-100 text-yellow-800', 'deleted' => 'bg-red-100 text-red-800', 'login' => 'bg-blue-100 text-blue-800', 'default' => 'bg-gray-100 text-gray-800' ]; $colorClass = $actionColors[$log->action] ?? $actionColors['default']; @endphp {{ $log->action }} {{ $log->description }} @if($log->old_values || $log->new_values) @endif {{ $log->entity_type ? class_basename($log->entity_type) . ' #' . $log->entity_id : '-' }} {{ $log->ip_address }}
{{ $logs->links() }}
@else

No audit logs found.

@endif
@endsection @section('scripts')