@extends('layouts.app') @section('title', 'Audit Trail Details') @section('page-header')

Audit Trail Details

Record #{{ $audit->id }}
Back to List
@endsection @section('content')
Audit Record #{{ $audit->id }}
Action {{ ucfirst(str_replace('_', ' ', $audit->action)) }}
User
{{ strtoupper(substr($audit->user->name ?? 'S', 0, 1)) }}
{{ $audit->user->name ?? 'System' }} {{ $audit->user->email ?? 'N/A' }}
Model Type {{ class_basename($audit->model_type) }}
Model ID #{{ $audit->model_id ?? 'N/A' }}
IP Address {{ $audit->ip_address ?? 'N/A' }}
User Agent {{ Str::limit($audit->user_agent ?? 'N/A', 50) }}
Created At {{ $audit->created_at?->format('d-M-Y H:i:s') ?? 'N/A' }}
Last Updated {{ $audit->updated_at?->format('d-M-Y H:i:s') ?? 'N/A' }}

@if($audit->old_values || $audit->new_values)
Data Changes
@if($audit->old_values)
Old Values
{{ json_encode($audit->old_values, JSON_PRETTY_PRINT) }}
@endif @if($audit->new_values)
New Values
{{ json_encode($audit->new_values, JSON_PRETTY_PRINT) }}
@endif
@else
No data changes recorded for this event.
@endif
Quick Actions
Back to List
Security Context
Action Type @php $actionTypeBadge = match(true) { in_array($audit->action, ['login', 'logout']) => ['badge bg-info text-white', 'Authentication'], in_array($audit->action, ['login_failed', 'otp_verification_failed']) => ['badge bg-danger text-white', 'Security Event'], in_array($audit->action, ['created', 'updated', 'deleted']) => ['badge bg-success text-white', 'Data Operation'], default => ['badge bg-secondary text-white', 'Other'] }; @endphp {{ $actionTypeBadge[1] }}
Risk Level @php $riskBadge = match(true) { in_array($audit->action, ['login_failed', 'otp_verification_failed', 'deleted']) => ['badge bg-danger text-white', 'High'], in_array($audit->action, ['updated', 'created']) => ['badge bg-warning text-dark', 'Medium'], default => ['badge bg-success text-white', 'Low'] }; @endphp {{ $riskBadge[1] }}
@endsection @push('styles') @endpush