Permalink
Browse files

logout as admin when logout as user

  • Loading branch information...
dog-ears committed Nov 17, 2016
1 parent 960fc54 commit 95f97aa9b08ce2ee5b186c12bc4a4e9d445c3942
Showing with 20 additions and 1 deletion.
  1. +19 −1 app/Http/Controllers/Auth/AuthController.php
  2. +1 −0 app/Http/routes.php
@@ -37,7 +37,7 @@ class AuthController extends Controller
*/
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
$this->middleware($this->guestMiddleware(), ['except' => 'logoutAll']);
}
/**
@@ -69,4 +69,22 @@ protected function create(array $data)
'password' => bcrypt($data['password']),
]);
}
/**
* If user login as auth too, logout auth and users
*
* @return redirect
*/
protected function logoutAll()
{
//logout as admin
if( \Auth::guard("admin")->check() ){
\Auth::guard("admin")->logout();
}
//logout as user
return( $this->logout() );
}
}
View
@@ -16,6 +16,7 @@
});
Route::auth();
$this->get('logout', 'Auth\AuthController@logoutAll');
Route::group(['middleware' => 'auth'], function () {

0 comments on commit 95f97aa

Please sign in to comment.