@extends('app-new') @section('content')
| # | Action | Changed Fields | Done By | Date |
|---|---|---|---|---|
| {{ $key + 1 }} | {{ ucfirst($log->action) }} |
@if($log->action == 'created')
Item Name: {{ $log->new_values['item_name'] ?? '-' }} Rate: {{ $log->new_values['rate'] ?? '-' }} Status: {{ $log->new_values['status'] ?? '-' }} @else @php $old = $log->old_values ?? []; $new = $log->new_values ?? []; $changed = []; foreach ($new as $field => $newVal) { $oldVal = $old[$field] ?? null; if ($oldVal != $newVal && !in_array($field, ['updated_at', 'created_at'])) { $changed[$field] = ['old' => $oldVal, 'new' => $newVal]; } } @endphp @if(count($changed) > 0) @foreach ($changed as $field => $values)
{{ ucfirst(str_replace('_', ' ', $field)) }}:
{{ $values['old'] ?? '-' }}
→
{{ $values['new'] ?? '-' }}
@endforeach
@else
No field changes
@endif
@endif
|
{{ $log->createdBy->name ?? 'N/A' }} | {{ $log->created_at->format('d-m-Y h:i A') }} |