Audit Logs

@foreach($logs as $log) @endforeach
Who Action Model Changes Date
{{ $log->causer->name ?? 'System' }} @if($log->description == 'created') Created @elseif($log->description == 'updated') Updated @elseif($log->description == 'deleted') Deleted @else {{ $log->description }} @endif {{ class_basename($log->subject_type) }} @php $properties = $log->properties ?? []; $attributes = data_get($properties, 'attributes', []); $old = data_get($properties, 'old', []); $new = data_get($properties, 'new', []); $extras = collect($properties)->except(['attributes', 'old', 'new']); @endphp @if(count($attributes)) @foreach($attributes as $key => $value)
{{ ucfirst(str_replace('_', ' ', $key)) }}: {{ is_array($value) ? implode(', ', $value) : $value }} @if(array_key_exists($key, $old)) (was: {{ is_array($old[$key]) ? implode(', ', $old[$key]) : $old[$key] }}) @endif
@endforeach @elseif(count($new)) @foreach($new as $key => $value)
{{ ucfirst(str_replace('_', ' ', $key)) }}: {{ is_array($old[$key] ?? null) ? implode(', ', $old[$key]) : ($old[$key] ?? '') }} → {{ is_array($value) ? implode(', ', $value) : $value }}
@endforeach @elseif($extras->isNotEmpty()) @foreach($extras as $key => $value)
{{ ucfirst(str_replace('_', ' ', $key)) }}: {{ is_array($value) ? implode(', ', $value) : $value }}
@endforeach @else No visible changes @endif
{{ $log->created_at->format('d M Y, h:i A') }}
{{ $logs->links() }}