@extends('nexus.layouts.app') @section('page-title', 'Audit Log') @section('sys-mode', 'AUDIT LOG') @section('content') {{-- PAGE HEADER --}} {{-- FILTERS --}}
TO @if (request()->hasAny(['event', 'user_id', 'session_id', 'date_from', 'date_to'])) CLEAR @endif
{{-- AUDIT TABLE --}} @if ($auditLogs->count() > 0) @foreach ($auditLogs as $log) @php $logId = $log->id; $logEvent = $log->event ?? ''; $logActorType = $log->actor_type ?? ''; $logActorId = $log->actor_id ?? ''; $logUserId = $log->subject_user_id ?? ''; $logSessionId = $log->nexus_session_id ?? ''; $logContext = $log->context ?? null; $logNotes = $log->notes ?? ''; $logCreated = $log->created_at ?? ''; $hasContext = !empty($logContext); @endphp @if ($hasContext) @endif @endforeach
ID Timestamp Event Actor User Session Context
{{ $logId }} {{ $logCreated ? \Carbon\Carbon::parse($logCreated)->format('M d H:i:s') : '' }} {{ $logEvent }} {{ $logActorType }}{{ $logActorId ? ' #' . $logActorId : '' }} {{ $logUserId ?: '-' }} {{ $logSessionId ?: '-' }} @if ($hasContext) VIEW @elseif ($logNotes) {{ \Illuminate\Support\Str::limit($logNotes, 40) }} @else - @endif
@php $decoded = is_string($logContext) ? json_decode($logContext, true) : $logContext; if (is_array($decoded)) { array_walk_recursive($decoded, function (&$val) { if (is_float($val)) $val = round($val, 4); }); echo json_encode($decoded, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } else { echo $logContext; } @endphp
{{-- PAGINATION --}} @if ($auditLogs->hasPages()) @endif @else
No audit records found{{ request()->hasAny(['event', 'user_id', 'session_id', 'date_from', 'date_to']) ? ' matching filters' : '' }}
@endif @endsection