From 85aceedd1fe4c1d4cd2ac69bfca12d247f5e9562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Mon, 16 Nov 2026 18:34:09 +0100 Subject: [PATCH] fix(http): guard null route when redirecting guests in middleware --- bootstrap/middlewares.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/middlewares.php b/bootstrap/middlewares.php index 6f1414b2..a8f4c8ab 100644 --- a/bootstrap/middlewares.php +++ b/bootstrap/middlewares.php @@ -27,7 +27,7 @@ $redirectGuests = function (Request $request) { app(FlashMessageService::class)->warning(__('Please log in to continue.')); - foreach ($request->route()->gatherMiddleware() as $middleware) { + foreach ($request->route()?->gatherMiddleware() ?? [] as $middleware) { if (\is_string($middleware) && str_contains($middleware, 'auth:')) { $route = $logins[str_replace('auth:', '', $middleware)] ?? null; if ($route) {