Laravel 6自定义auth logout后的跳转链接:

方法一:

修改Auth/LoginController.php

添加:


use IlluminateHttpRequest;

将:


use AuthenticatesUsers;

修改为:


use AuthenticatesUsers{
    logout as performLogout;
}

新增Logout方法:


public function logout(Request $request)
    {
        $this->performLogout($request);
        return redirect()->route('login');
}

方法二:

修改Auth/LoginController.php

添加:


use IlluminateHttpRequest;

新增logout方法:


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