@extends('layouts.dashboard') @section('content') @php /** * Super-admin audit trail. A read-only timeline of every privileged mutation * recorded by audit_log() (core/Helpers.php). * * @var array $rows audit rows joined to the acting user (name/email), newest first * @var array $pager pagination metadata from paginate() * @var array $filters active filters [action?, role?, entity?, ip?, date_from?, date_to?, q?, restaurant_id?] * @var array $actions distinct action verbs present in the trail (for the dropdown) * @var array $entities distinct entity kinds present in the trail (for the dropdown) */ // Filter options come from the roles table, so a role created on the Roles screen can be // filtered on here the moment it exists. $roles = array_keys(\App\Models\Role::map()); $entities = $entities ?? []; // The export is this page in another format, so it carries the same filters. $exportQuery = '?' . http_build_query(array_merge($filters, ['export' => 'csv'])); // Action verbs are namespaced ("restaurant.approve", "user.suspend"). The verb // after the last dot drives the pill colour so destructive vs. neutral events // read at a glance, with everything else falling back to a neutral grey. $pillFor = static function (string $action): string { $pos = strrpos($action, '.'); $verb = strtolower($pos === false ? $action : substr($action, $pos + 1)); if (in_array($verb, ['delete', 'suspend', 'reject', 'login_fail', 'remove'], true)) { return 'qm-pill-red'; } if (in_array($verb, ['approve', 'activate', 'create', 'register', 'paid', 'login', 'reinstate'], true)) { return 'qm-pill-green'; } if (in_array($verb, ['update', 'status', 'role', 'save'], true)) { return 'qm-pill-amber'; } return 'qm-pill-grey'; }; @endphp @php /* .qm-d2: the dashboard density standard (app.css ยง35) */ @endphp
{{ t_raw('admin.audit.subhead') }}
| {{ t_raw('admin.audit.col_when') }} | {{ t_raw('admin.audit.col_user') }} | {{ t_raw('admin.audit.filter_action_label') }} | {{ t_raw('admin.audit.col_entity') }} | {{ t_raw('admin.audit.col_detail') }} | {{ t_raw('admin.audit.col_ip') }} |
|---|---|---|---|---|---|
| {{ time_ago($row['created_at']) }} |
@if (!empty($row['user_name']) || !empty($row['user_id']))
@php $auditName = !empty($row['user_name']) ? (string) $row['user_name'] : t_raw('admin.audit.user_hash_prefix', [':id' => (int) $row['user_id']]);
@endphp
{!! brandmark_html($row['user_avatar'] ?? null, $auditName, 'md', 'qm-brandmark--round') !!}
@else
{{ t_raw('admin.audit.system_or_guest') }}
@endif
{{ $auditName }}
@if (!empty($row['role']))
{!! role_pill((string) $row['role']) !!} @endif
|
{{ activity_label((string) $row['action']) }} |
{{ $row['entity'] }}@if ($row['entity_id'] !== null && $row['entity_id'] !== '') #{{ (int) $row['entity_id'] }}@endif
@if (!empty($row['restaurant_id'])) {{ t_raw('admin.audit.restaurant_hash_prefix', [':id' => (int) $row['restaurant_id']]) }} @endif
|
{{ history_detail($row["detail"] ?? null) }} |
{{ $row['ip'] ?? '' }} |