@once @php // Read only feedback keys, never authentication state or arbitrary session data. $appToastFlashes = []; $appToastStatusMessages = [ 'profile-updated' => 'Profile updated successfully.', 'password-updated' => 'Password updated successfully.', 'verification-link-sent' => 'A new verification link has been sent to your email address.', ]; if (request()->hasSession()) { foreach (['success' => 'success', 'info' => 'info', 'warning' => 'warning', 'warn' => 'warning', 'error' => 'error', 'danger' => 'error', 'status' => 'info', 'message' => 'info', 'contact_success' => 'success', 'webterminal_error' => 'error'] as $appToastKey => $appToastType) { $appToastValue = session($appToastKey); if (is_string($appToastValue) && trim($appToastValue) !== '') { $appToastFlashes[] = ['type' => isset($appToastStatusMessages[$appToastValue]) ? 'success' : $appToastType, 'message' => $appToastStatusMessages[$appToastValue] ?? $appToastValue]; } } } if (isset($errors) && $errors instanceof \Illuminate\Support\ViewErrorBag) { $appToastErrors = []; foreach ($errors->getBags() as $appToastErrorBag) { $appToastErrors = array_merge($appToastErrors, $appToastErrorBag->all()); } if ($appToastErrors) { $appToastFlashes[] = ['type' => 'error', 'message' => implode("\n", array_unique($appToastErrors))]; } } @endphp @endonce