@php // Every logged value is user-controlled data (names, notes, addresses…), // so it is ALWAYS printed escaped. Arrays/objects are shown as JSON text. $properties = collect($logDetails->properties ?? []); $new = (array) ($properties->get('attributes') ?? []); $old = (array) ($properties->get('old') ?? []); $show = static function ($value): string { if (is_null($value)) { return ''; } if (is_bool($value)) { return $value ? 'true' : 'false'; } if (is_array($value) || is_object($value)) { return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) ?: ''; } return (string) $value; }; $keys = $new !== [] ? array_keys($new) : array_keys($old); @endphp
| {{ ___('label.log_name') }} | {{ ___('label.new') }} | {{ ___('label.old') }} |
|---|---|---|
| {{ ___("label.{$key}") }} | {{ $show($new[$key] ?? null) }} | {{ $show($old[$key] ?? null) }} |