@php $properties = $getState(); $old = $properties['old'] ?? []; $attributes = $properties['attributes'] ?? []; // 获取所有键 $allKeys = array_unique(array_merge(array_keys($old), array_keys($attributes))); @endphp @if(empty($allKeys))
无变更数据
@else
@foreach($allKeys as $key) @php $oldValue = $old[$key] ?? null; $newValue = $attributes[$key] ?? null; $hasChanged = $oldValue !== $newValue; @endphp @endforeach
字段 旧值 新值
{{ $key }} @if($hasChanged) 已变更 @endif @if($oldValue !== null)
@if(is_array($oldValue) || is_object($oldValue))
{{ json_encode($oldValue, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) }}
@else {{ $oldValue }} @endif
@else - @endif
@if($newValue !== null)
@if(is_array($newValue) || is_object($newValue))
{{ json_encode($newValue, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) }}
@else {{ $newValue }} @endif
@else - @endif
@if(!empty($old) || !empty($attributes))
查看原始 JSON 数据
@if(!empty($old))
旧值 (JSON):
{{ json_encode($old, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) }}
@endif @if(!empty($attributes))
新值 (JSON):
{{ json_encode($attributes, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) }}
@endif
@endif @endif