From f6f534fb9d8c0145f025afb33c490c755cb718f4 Mon Sep 17 00:00:00 2001 From: Joel Butcher Date: Thu, 25 Jul 2024 08:27:34 +0100 Subject: [PATCH 1/2] fix trait --- src/Concerns/ConfirmsFilament.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Concerns/ConfirmsFilament.php b/src/Concerns/ConfirmsFilament.php index 1b5e045..08a900a 100644 --- a/src/Concerns/ConfirmsFilament.php +++ b/src/Concerns/ConfirmsFilament.php @@ -40,10 +40,10 @@ public function cameFromFilamentAuthRoute(): bool $previousRoute = Session::get('socialstream.previous_url'); return in_array($previousRoute, [ - route('filament.auth.login'), - route('filament.admin.auth.login'), - route('filament.auth.register'), - route('filament.admin.auth.register'), + ...Route::has('filament.auth.login') ? [route('filament.auth.login')] : [], + ...Route::has('filament.admin.auth.login') ? [route('filament.admin.auth.login')] : [], + ...Route::has('filament.auth.register') ? [route('filament.auth.register')] : [], + ...Route::has('filament.admin.auth.register') ? [route('filament.admin.auth.register')] : [], ]); } From 3df9fdfc59ff449a7feb6360a003d52f18d62306 Mon Sep 17 00:00:00 2001 From: Joel Butcher Date: Thu, 25 Jul 2024 08:29:02 +0100 Subject: [PATCH 2/2] simplify approach --- src/Concerns/ConfirmsFilament.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Concerns/ConfirmsFilament.php b/src/Concerns/ConfirmsFilament.php index 08a900a..faf83da 100644 --- a/src/Concerns/ConfirmsFilament.php +++ b/src/Concerns/ConfirmsFilament.php @@ -39,12 +39,12 @@ public function cameFromFilamentAuthRoute(): bool { $previousRoute = Session::get('socialstream.previous_url'); - return in_array($previousRoute, [ - ...Route::has('filament.auth.login') ? [route('filament.auth.login')] : [], - ...Route::has('filament.admin.auth.login') ? [route('filament.admin.auth.login')] : [], - ...Route::has('filament.auth.register') ? [route('filament.auth.register')] : [], - ...Route::has('filament.admin.auth.register') ? [route('filament.admin.auth.register')] : [], - ]); + return in_array($previousRoute, array_filter([ + Route::has('filament.auth.login') ? route('filament.auth.login') : null, + Route::has('filament.admin.auth.login') ? route('filament.admin.auth.login') : null, + Route::has('filament.auth.register') ? route('filament.auth.register') : null, + Route::has('filament.admin.auth.register') ? route('filament.admin.auth.register') : null, + ])); } public function hasFilamentLoginRoutes(): bool