How to change the redirect url when logging out?

后端 未结 8 2068
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 16:08

I\'m working with Laravel 5 authentification system provided by default. After logging out, a user is redirected to the root page but I\'d like to change that. I managed to

8条回答
  •  执念已碎
    2020-12-16 16:29

    it'only laravel versi 5.4 if you want custom redirect url logout, open /your-project-laravel/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php and edit redirect based on you needed

      public function logout(Request $request)
        {
            $this->guard()->logout();
    
            $request->session()->flush();
    
            $request->session()->regenerate();
    
            return redirect('/login');
        }
    

提交回复
热议问题