Auditoría
Registro global
Volver
Limpiar
@forelse($items as $a) @php $actionLabel = match($a->action) { 'created' => 'Creada', 'updated' => 'Modificada', 'deleted' => 'Borrada', 'email_sent'=> 'Correo enviado', 'test' => 'Prueba', default => $a->action, }; @endphp @empty @endforelse
Fecha Expediente Acción Actor IP Cambios
{{ $a->created_at?->format('d/m/Y H:i') ?? '—' }} #{{ $a->expediente_id ?? '—' }} {{ $actionLabel }} {{ $a->actor?->name ?? '—' }}
{{ $a->actor_email }}
{{ $a->ip ?? '—' }} @if($a->changes) @php $lines = []; foreach ($a->changes as $field => $diff) { $from = $diff['from'] ?? null; $to = $diff['to'] ?? null; // Normaliza fechas típicas $fmtDate = function ($v) { if ($v === null || $v === '') return '—'; try { // Si es ISO o datetime, Carbon lo pilla return \Carbon\Carbon::parse($v)->format('d/m/Y'); } catch (\Throwable $e) { return is_string($v) ? $v : json_encode($v, JSON_UNESCAPED_UNICODE); } }; // Campos que quieres tratar como fecha if (in_array($field, ['fecha', 'created_at', 'updated_at'], true)) { $fromTxt = $fmtDate($from); $toTxt = $fmtDate($to); } else { $fromTxt = ($from !== null && $from !== '') ? (is_string($from) ? $from : json_encode($from, JSON_UNESCAPED_UNICODE)) : '—'; $toTxt = ($to !== null && $to !== '') ? (is_string($to) ? $to : json_encode($to, JSON_UNESCAPED_UNICODE)) : '—'; } // Etiquetas bonitas en español $label = match($field) { 'razon_social' => 'Razón social', 'email_agente' => 'Email agente', 'agente' => 'Agente', 'dni_cif' => 'DNI/CIF', 'direccion_suministro' => 'Dirección suministro', 'localidad' => 'Localidad', 'observaciones' => 'Observaciones', 'estado' => 'Estado', 'tipo' => 'Tipo', 'fecha' => 'Fecha', default => $field, }; $lines[] = "
{$label}: " . e($fromTxt) . " " . e($toTxt) . "
"; } @endphp
{!! implode('', $lines) !!}
@elseif($a->snapshot) snapshot guardado @else — @endif
Sin registros.
{{ $items->links() }}