Laravel 5.2: Auth::logout() is not working

前端 未结 8 1450
孤独总比滥情好
孤独总比滥情好 2020-12-16 00:04

I\'m building a very simple app in Laravel 5.2, but when using AuthController\'s action to log out, it just simply doesn\'t work. I have a nav bar which checks

8条回答
  •  隐瞒了意图╮
    2020-12-16 00:20

    I also had similar problem in Laravel 5.2. You should change your route to

    Route::get('auth/logout', 'Auth\AuthController@logout');
    

    or in AuthController constructor add

    public function __construct()
    {
        $this->middleware('guest', ['except' => ['logout', 'getLogout']]);
    }
    

    That worked for me.

提交回复
热议问题