{{-- Flash messages. Rendered as Bootstrap alerts, but hidden on first paint: public/js/learnify-toast.js turns each one into a SweetAlert2 toast (top right) and removes it. If SweetAlert never loads, the JS un-hides them, so the message is still read as an inline alert. data-lf-flash = the toast type; data-lf-flash-text / -item = the copy. --}} @php($lfFlashes = collect([ 'success' => [session('success'), 'bi-check-circle-fill', 'alert-success'], 'error' => [session('error'), 'bi-exclamation-triangle-fill', 'alert-danger'], 'warning' => [session('warning'), 'bi-exclamation-circle-fill', 'alert-warning'], 'info' => [session('status'), 'bi-info-circle-fill', 'alert-info'], ])->filter(fn ($f) => filled($f[0]))) @if ($lfFlashes->isNotEmpty() || $errors->any())
@foreach ($lfFlashes as $type => [$message, $icon, $class]) @endforeach @if ($errors->any()) @endif
@endif