@php $notificationTypes = [ 'success' => 'success', 'error' => 'danger', 'warning' => 'warning', 'info' => 'info', ]; $hasNotifications = $errors->any() || collect(array_keys($notificationTypes))->contains(fn ($key) => session()->has($key)); @endphp @if($hasNotifications)
@foreach($notificationTypes as $key => $type) @if(session()->has($key)) @endif @endforeach @if($errors->any()) @endif
@endif @once @push('scripts') @endpush @endonce