diff --git a/src/Controllers/LoginController.php b/src/Controllers/LoginController.php index ef2fec9ca..3478cdfa1 100644 --- a/src/Controllers/LoginController.php +++ b/src/Controllers/LoginController.php @@ -101,8 +101,12 @@ protected function getValidationRules(): array */ public function logoutAction(): RedirectResponse { + // Capture logout redirect URL before auth logout, + // otherwise you cannot check the user in `logoutRedirect()`. + $url = config('Auth')->logoutRedirect(); + auth()->logout(); - return redirect()->to(config('Auth')->logoutRedirect())->with('message', lang('Auth.successLogout')); + return redirect()->to($url)->with('message', lang('Auth.successLogout')); } }