@extends('layouts.master') @section('content')
{{ $title }}
@if(isset($error) || session('error'))
{{ $error ?? session('error') }}
@endif @if(session('success'))
{{ session('success') }}
@endif
@forelse($data as $audit) @php $user = \App\Models\User::find($audit->user_id); @endphp @empty @endforelse
ID Type Event Old Value New Value User IP Address Created At Updated At
{{ $audit->auditable_id }} {{ $audit->auditable_type }} {{ $audit->event }} {!! formatJson($audit->old_values) !!} {!! formatJson($audit->new_values) !!} {{ $user?$user->name:'System'}} {{ $audit->ip_address }} {{ $audit->created_at }} {{ $audit->updated_at }}
No audit logs available.
@php function formatJson($data) { // Check if $data is already an array if (is_array($data)) { return '
' . json_encode($data, JSON_PRETTY_PRINT) . '
'; } // Decode the JSON string $decoded = json_decode($data); // Check if decoding was successful if ($decoded === null) { return 'Invalid JSON'; } // Format the decoded data for display return '
' . json_encode($decoded, JSON_PRETTY_PRINT) . '
'; } @endphp @endsection @section('scripts') @endsection