@extends('layouts.admin') @section('title', 'Audit Log | Super Admin') @section('page_title', 'Audit Log') @push('styles') @endpush @section('content') @php $logCollection = $activityLogs->getCollection(); $totalActivities = method_exists($activityLogs, 'total') ? (int) $activityLogs->total() : (int) $activityLogs->count(); $todayActivities = $logCollection->filter(function ($log) { return $log->created_at && \Illuminate\Support\Carbon::parse($log->created_at)->isToday(); })->count(); $activeUsersInLogs = $logCollection->pluck('user_id')->filter()->unique()->count(); $actionGroups = $logCollection->countBy(function ($log) { return strtolower((string) $log->action); }); $topAction = $actionGroups->sortDesc()->keys()->first(); $targetGroups = $logCollection->countBy(function ($log) { return strtolower((string) $log->target_type); }); $topTargetType = $targetGroups->sortDesc()->keys()->first(); $targetTypeOptions = $logCollection ->pluck('target_type') ->filter() ->map(fn($value) => strtolower((string) $value)) ->unique() ->values(); $actionBadge = function (?string $action): string { $normalized = strtolower((string) $action); return match (true) { str_contains($normalized, 'create'), str_contains($normalized, 'store') => 'is-success', str_contains($normalized, 'update'), str_contains($normalized, 'edit') => 'is-info', str_contains($normalized, 'delete'), str_contains($normalized, 'destroy') => 'is-danger', str_contains($normalized, 'verify'), str_contains($normalized, 'approve') => 'is-verify', str_contains($normalized, 'reject'), str_contains($normalized, 'cancel') => 'is-warning', str_contains($normalized, 'login'), str_contains($normalized, 'logout'), str_contains($normalized, 'system') => 'is-muted', default => 'is-muted', }; }; $targetBadge = function (?string $targetType): string { $normalized = strtolower((string) $targetType); return match ($normalized) { 'booking' => 'is-booking', 'payment' => 'is-payment', 'vehicle' => 'is-vehicle', 'rental', 'rental_company' => 'is-rental', 'promo' => 'is-promo', 'review' => 'is-review', 'user' => 'is-user', default => 'is-system', }; }; $prettyLabel = function (?string $raw): string { $normalized = str_replace(['.', '_'], [' / ', ' '], strtolower((string) $raw)); return ucwords(trim($normalized) === '' ? '-' : trim($normalized)); }; @endphp
Super Admin Audit Log

Audit Log

Pantau aktivitas penting sistem dan perubahan data yang dilakukan oleh pengguna platform.

@if ($errors->any()) @endif @if (session('success'))
{{ session('success') }}
@endif @if (session('error')) @endif @if (session('warning')) @endif @if (session('info'))
{{ session('info') }}
@endif
Reset Filter

Total Aktivitas

{{ number_format($totalActivities, 0, ',', '.') }}

Aktivitas Hari Ini

{{ number_format($todayActivities, 0, ',', '.') }}

berdasarkan halaman ini

Total User Aktif di Log

{{ number_format($activeUsersInLogs, 0, ',', '.') }}

berdasarkan halaman ini

Action / Target Terbanyak

{{ $prettyLabel($topAction) }}

{{ $prettyLabel($topTargetType) }}
Buka Laporan Super Admin Kembali ke Dashboard

Data Audit Log

Log terbaru ditampilkan di atas untuk membantu investigasi aktivitas sistem.

@if ($activityLogs->count() > 0)
@foreach ($activityLogs as $index => $log) @php $createdAt = $log->created_at ? \Illuminate\Support\Carbon::parse($log->created_at) : null; $metaSummary = '-'; if (is_array($log->meta) && count($log->meta) > 0) { $pairs = collect($log->meta) ->take(3) ->map(function ($value, $key) { $keyText = str_replace('_', ' ', (string) $key); $valueText = is_scalar($value) ? (string) $value : json_encode($value); return $keyText . ': ' . $valueText; }) ->values(); $metaSummary = $pairs->implode(' | '); } @endphp @endforeach
No Waktu User Action Target Type Target ID Deskripsi Meta / Detail Singkat Aksi
{{ ($activityLogs->firstItem() ?? 1) + $index }} {{ $createdAt?->format('d M Y') ?? '-' }}
{{ $createdAt?->format('H:i:s') ?? '-' }}
@if ($log->user) {{ $log->user->name }}
{{ $log->user->email }} @else System
Unknown User @endif
{{ $prettyLabel($log->action) }} {{ $prettyLabel($log->target_type) }} {{ $log->target_id ?? '-' }}
{{ $log->description ?? '-' }}
{{ $metaSummary }}
@if (Route::has('super-admin.activity-logs.show')) Detail @else Detail @endif
{{ $activityLogs->links() }}
@else

Belum ada data audit log

Aktivitas sistem akan muncul di halaman ini saat pengguna mulai melakukan aksi pada platform.

@endif
@endsection