{{-- The fields of one audit entry: [before, after] pairs for a change, or the values sent/created. --}} @php $c = (array) ($e->changes ?? []); $show = fn ($v) => $v === null ? '–' : (is_bool($v) ? ($v ? 'yes' : 'no') : (is_array($v) ? json_encode($v, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : (string) $v)); $pairs = collect($c)->every(fn ($v, $k) => is_array($v) && array_is_list($v) && count($v) === 2) && ! isset($c['new'], $c['old'], $c['input']); @endphp @if ($c)
Details @if ($pairs) @foreach ($c as $field => [$before, $after]) @endforeach @else @foreach ($c as $group => $fields) @foreach ((is_array($fields) ? $fields : [$group => $fields]) as $field => $value) @endforeach @endforeach @endif
{{ str_replace('_', ' ', $field) }}{{ \Illuminate\Support\Str::limit($show($before), 300) }}{{ \Illuminate\Support\Str::limit($show($after), 300) }}
{{ is_array($fields) && $group !== 'new' && $group !== 'old' ? $group.': ' : '' }}{{ str_replace('_', ' ', (string) $field) }}{{ \Illuminate\Support\Str::limit($show($value), 300) }}
@endif