@php $incidents = $navigation->getIncidents(); $counts = collect($incidents)->groupBy('type')->map->count(); @endphp
@foreach ($navigation->getIncidents() as $incident) @php $type = $incident['type']; $config = match($type) { 'info' => [ 'icon' => 'fa-info-circle', 'alert_class' => 'alert-info', 'border_class' => 'border-info', 'text_class' => 'text-info', 'btn_class' => 'btn-info' ], 'success' => [ 'icon' => 'fa-check-circle', 'alert_class' => 'alert-success', 'border_class' => 'border-success', 'text_class' => 'text-success', 'btn_class' => 'btn-success' ], 'warning' => [ 'icon' => 'fa-exclamation-triangle', 'alert_class' => 'alert-warning', 'border_class' => 'border-warning', 'text_class' => 'text-warning', 'btn_class' => 'btn-warning' ], 'danger' => [ 'icon' => 'fa-exclamation-circle', 'alert_class' => 'alert-danger', 'border_class' => 'border-danger', 'text_class' => 'text-danger', 'btn_class' => 'btn-danger' ], default => [ 'icon' => 'fa-bell', 'alert_class' => 'alert-secondary', 'border_class' => 'border-secondary', 'text_class' => 'text-secondary', 'btn_class' => 'btn-secondary' ] }; @endphp @endforeach