Skip to content

Commit

Permalink
Adding redirect URL capture to prevent redirect error
Browse files Browse the repository at this point in the history
  • Loading branch information
cornejobarraza committed Dec 31, 2022
1 parent 3fede09 commit 924c89c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Controllers/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ protected function getValidationRules(): array
*/
public function logoutAction(): RedirectResponse
{
// Capture logout redirect URL before auth logout,
// otherwise 'Call to a member function inGroup() on null' is thrown
$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'));
}
}

0 comments on commit 924c89c

Please sign in to comment.