@extends('layouts.layout-horizontal') @section('title', 'Activity Details') @section('content')
Activity Details
Back

{{ $activity->created_at->format('d-M-Y h:i:s A') }}

{{ $activity->user->name ?? 'Unknown' }}

@if($activity->action === 'created') Created @elseif($activity->action === 'updated') Updated @elseif($activity->action === 'deleted') Deleted @else {{ ucfirst($activity->action) }} @endif

{{ $activity->model_label }} (ID: {{ $activity->model_id }})

{{ $activity->description }}

{{ $activity->company->name ?? '-' }}

{{ $activity->ip_address ?? '-' }}

{{-- Changes Section --}} @if($activity->action === 'updated' && $activity->old_values && $activity->new_values)
Changes Made
@foreach($activity->old_values as $key => $oldValue) @if(isset($activity->new_values[$key]) && $oldValue != $activity->new_values[$key]) @endif @endforeach
Field Old Value New Value
{{ ucwords(str_replace('_', ' ', $key)) }} {{ is_array($oldValue) ? json_encode($oldValue) : $oldValue }} {{ is_array($activity->new_values[$key]) ? json_encode($activity->new_values[$key]) : $activity->new_values[$key] }}
@endif {{-- New Values for Created --}} @if($activity->action === 'created' && $activity->new_values)
Record Data
@foreach($activity->new_values as $key => $value) @if(!in_array($key, ['created_at', 'updated_at', 'id'])) @endif @endforeach
Field Value
{{ ucwords(str_replace('_', ' ', $key)) }} @if(is_array($value)) {{ json_encode($value) }} @elseif(is_null($value)) null @else {{ $value }} @endif
@endif {{-- Old Values for Deleted --}} @if($activity->action === 'deleted' && $activity->old_values)
Deleted Record Data
@foreach($activity->old_values as $key => $value) @if(!in_array($key, ['created_at', 'updated_at'])) @endif @endforeach
Field Value
{{ ucwords(str_replace('_', ' ', $key)) }} @if(is_array($value)) {{ json_encode($value) }} @elseif(is_null($value)) null @else {{ $value }} @endif
@endif
User Agent
{{ $activity->user_agent ?? 'Not recorded' }}
@endsection