1130 0 0 0
Last Updated : 2025-04-28 23:59:55
how to create working logout function specially for multi auth in laravel or for the admins
at the adminLoginController (the controller you specified) add logout function as follows
public function logout() {
Auth::guard('admin')->logout(); // use guard name as you want
return view("default.adminAuth.adminLogin") ; // redirection
}
but the most important thing that you must do is tho make exception in middleware with admin guard to except logout function as follows
public function __construct() {
$this->middleware('guest:admin', ['except' => ['logout']] ) ; // note that there is an array inside another array & logout is the name of logout function
}