@extends('layouts.app') @section('title', 'Activity Log') @push('styles') @endpush @section('content') {{-- Filter Bar --}}
Reset
{{-- Activity Table --}} @if(isset($logs) && $logs->count() > 0)
@foreach($logs as $log) @php $createdAt = $log->created_at ?? null; $actionStr = (string) ($log->action ?? ''); $actionPrefix = strtolower(explode('.', $actionStr)[0] ?? ''); $userName = $log->user_name ?? ($log->user->name ?? 'System'); $ip = $log->ip_address ?? null; $subjectType = $log->subject_type ?? null; $subjectId = $log->subject_id ?? null; $subjectTypeShort = $subjectType ? class_basename($subjectType) : null; $metadata = $log->metadata ?? null; if (is_string($metadata)) { $decoded = json_decode($metadata, true); if (json_last_error() === JSON_ERROR_NONE) { $metadata = $decoded; } } @endphp @endforeach
When User Action Subject Description
{{ $createdAt ? $createdAt->format('M d, Y ยท g:i A') : 'โ€”' }} @if($createdAt) {{ $createdAt->diffForHumans() }} @endif
{{ $userName ?: 'System' }} @if($ip) {{ $ip }} @endif
{{ $actionStr ?: 'unknown' }}
@if($subjectTypeShort)
{{ $subjectTypeShort }}
@endif @if($subjectId)
#{{ $subjectId }}
@endif @if(!$subjectTypeShort && !$subjectId) โ€” @endif
{{ $log->description ?? 'โ€”' }} @if(!empty($metadata) && is_array($metadata)) @endif
{{-- Pagination --}} @if(method_exists($logs, 'links'))
{{ $logs->withQueryString()->links() }}
@endif @else

No activity yet

Actions performed by you and your staff will appear here for audit and review.

@endif @endsection