@php $record = $getRecord(); $oldValues = $record->old_values ?? []; $newValues = $record->new_values ?? []; $allKeys = array_unique(array_merge(array_keys($oldValues), array_keys($newValues))); sort($allKeys); $formatValue = function ($val, $key = null) { if (is_null($val)) return 'null'; if (is_bool($val)) return $val ? 'true' : 'false'; if (is_array($val) || is_object($val)) { return json_encode($val, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); } $str = (string) $val; // Format empty HTML tags if ($str === '

' || trim($str) === '') { return '[empty]'; } // Format simple HTML strings if (str_contains($str, '

')) { $stripped = strip_tags($str); return empty(trim($stripped)) ? '[empty]' : trim($stripped); } // Parse date strings if (preg_match('/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}/', $str)) { try { return \Carbon\Carbon::parse($str)->format('M j, Y H:i:s'); } catch (\Exception $e) { // Fallback to original } } return $str; }; @endphp

@forelse ($allKeys as $key) @php $old = $oldValues[$key] ?? null; $new = $newValues[$key] ?? null; $hasOld = array_key_exists($key, $oldValues); $hasNew = array_key_exists($key, $newValues); $changed = $old !== $new; @endphp @empty @endforelse
Field Old Value New Value
{{ $key }} @if ($hasOld) @if ($changed) {{ $formatValue($old, $key) }} @else {{ $formatValue($old, $key) }} @endif @else not set @endif @if ($hasNew) @if ($changed) {{ $formatValue($new, $key) }} @else {{ $formatValue($new, $key) }} @endif @else removed @endif
No modified attributes recorded.