jeudi 28 novembre 2019

Use of undefined constant login - assumed 'login' (this will throw an Error in a future version of PHP) when trying to logout

when ever i want to logout, it always show "Use of undefined constant login - assumed 'login'" error. what did i do wrong?

web.php

route::get('/logout','AuthController@logout')->name('logout');

route::get('/','PagesController@home')->name('home');

AuthController.php

public function getLogin(){
        return view('login');
    }

    public function postLogin(Request $request){
       if(!\Auth::attempt(['email' => $request->email, 'password' => $request->password])){
        return redirect()->back();
       }
        return redirect()->route('home');
    }

public function logout(){
        \Auth::logout();
        return redirect()->route(login);
    }

PagesController.php

public function home()
    {
        return view('index') ;
    }

main.blade.php

<a href="">logout</a>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire