LoginSignup
1
1

More than 5 years have passed since last update.

【Laravel 5.7】標準のログアウト先を変更する

Posted at

php artisan make:auth で標準のログイン機能をつけたときに、ログアウト先が自動的にルートになってしまうのを変更する場合。

LoginController.php

use Illuminate\Http\Request;

class LoginController extends Controller
{
   // 追加
   public function logout(Request $request)
    {
        Auth::logout();

        $this->guard()->logout();

        $request->session()->invalidate();

        // /homeに変更
        return $this->loggedOut($request) ?: redirect('/home');
    }
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1