VPS主机
测评与优惠

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

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('/');  }
赞(0)
未经允许不得转载:主机之家测评 » Laravel 6自定义auth logout后的跳转链接

评论 抢沙发

评论前必须登录!

立即登录   注册