From 31ff2b739d6e6e3f070e598955d759e512e0907c Mon Sep 17 00:00:00 2001 From: Maxim Lanin Date: Thu, 15 Dec 2016 11:02:17 +0300 Subject: [PATCH] Allow users to set redirectAfterLogout path Reproduce lost #8132 PR --- src/Illuminate/Foundation/Auth/AuthenticatesUsers.php | 4 ++-- src/Illuminate/Foundation/Auth/RedirectsUsers.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php b/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php index c5a4802a7744..dcf241d95da6 100644 --- a/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php +++ b/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php @@ -144,7 +144,7 @@ public function username() /** * Log the user out of the application. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function logout(Request $request) @@ -155,7 +155,7 @@ public function logout(Request $request) $request->session()->regenerate(); - return redirect('/'); + return redirect($this->redirectAfterLogoutPath()); } /** diff --git a/src/Illuminate/Foundation/Auth/RedirectsUsers.php b/src/Illuminate/Foundation/Auth/RedirectsUsers.php index c86d9d96a662..3aa6d60e1a2b 100644 --- a/src/Illuminate/Foundation/Auth/RedirectsUsers.php +++ b/src/Illuminate/Foundation/Auth/RedirectsUsers.php @@ -13,4 +13,14 @@ public function redirectPath() { return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home'; } + + /** + * Get the post logout redirect path. + * + * @return string + */ + public function redirectAfterLogoutPath() + { + return property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/'; + } }