diff --git a/resources/views/pages/list-activities.blade.php b/resources/views/pages/list-activities.blade.php index 38b54a9..6d3bc91 100644 --- a/resources/views/pages/list-activities.blade.php +++ b/resources/views/pages/list-activities.blade.php @@ -4,6 +4,12 @@
@foreach($this->getActivities() as $activityItem) + + @php + /* @var \Spatie\Activitylog\Models\Activity $activityItem */ + $changes = $activityItem->getChangesAttribute(); + @endphp +
- @if ($this->canRestoreActivity()) + @if ($this->canRestoreActivity() && $changes->isNotEmpty())
- - - - @lang('filament-activity-log::activities.table.field') - - - @lang('filament-activity-log::activities.table.old') - - - @lang('filament-activity-log::activities.table.new') - - - @php - /* @var \Spatie\Activitylog\Models\Activity $activityItem */ - $changes = $activityItem->getChangesAttribute(); - @endphp - @foreach(data_get($changes, 'attributes', []) as $field => $change) - @php - $oldValue = data_get($changes, "old.{$field}"); - $newValue = data_get($changes, "attributes.{$field}"); - @endphp - $loop->even])> - - {{ $this->getFieldLabel($field) }} - - - @if(is_array($oldValue)) -
{{ json_encode($oldValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
- @else - {{ $oldValue }} - @endif -
- - @if(is_array($newValue)) -
{{ json_encode($newValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
- @else - {{ $newValue }} - @endif -
-
- @endforeach -
+ @if ($changes->isNotEmpty()) + + + + @lang('filament-activity-log::activities.table.field') + + + @lang('filament-activity-log::activities.table.old') + + + @lang('filament-activity-log::activities.table.new') + + + @foreach (data_get($changes, 'attributes', []) as $field => $change) + @php + $oldValue = data_get($changes, "old.{$field}"); + $newValue = data_get($changes, "attributes.{$field}"); + @endphp + $loop->even])> + + {{ $this->getFieldLabel($field) }} + + + @if(is_array($oldValue)) +
{{ json_encode($oldValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
+ @else + {{ $oldValue }} + @endif +
+ + @if(is_array($newValue)) +
{{ json_encode($newValue, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}
+ @else + {{ $newValue }} + @endif +
+
+ @endforeach +
+ @endif
@endforeach