@php $i = 1; @endphp @foreach ($audit->old_values as $key => $value) @php switch($key){ case 'status_type_id': $column = 'status'; $old_value = \Illuminate\Support\Facades\DB::table('status_types')->where('id',$value)->value('name_en'); $new_value = \Illuminate\Support\Facades\DB::table('status_types')->where('id',$audit->new_values[$key])->value('name_en'); break; default: $column = $key; $old_value = $value; $new_value = $audit->new_values[$key] ?? null; } @endphp @php $i++; @endphp @endforeach
# Column Old New
{{$i}} {{str_replace('_',' ',$column)}} {{$old_value}} {{$new_value}}