From 0a746d4a5f15bf92a3390ee864d286df4bca6df8 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 25 Feb 2015 15:36:25 +1030 Subject: [PATCH] Fix logout action --- framework/core/src/Web/Actions/LogoutAction.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/framework/core/src/Web/Actions/LogoutAction.php b/framework/core/src/Web/Actions/LogoutAction.php index a9775cc40..65cb314c4 100644 --- a/framework/core/src/Web/Actions/LogoutAction.php +++ b/framework/core/src/Web/Actions/LogoutAction.php @@ -1,16 +1,22 @@ accessTokens()->delete(); + $user = $this->actor->getUser(); - $this->event(new UserLoggedOut(Auth::user())); + if ($user->exists) { + $user->accessTokens()->delete(); - return Redirect::to('')->withCookie($this->makeForgetCookie()); + event(new UserLoggedOut($user)); + } + + return redirect('')->withCookie($this->makeForgetCookie()); } public function makeForgetCookie()