samedi 24 mars 2018

Laravel - Auth::check() returning false, but middleware auth not redirecting

So somehow i was managed to produce a situation where Auth::check() says that i'm not logged in, but middleware('auth') is still allowing acces to my class. The last thing i did was modify user data, but I did not log out, so im assuming Auth::check() is returning the wrong value. But why could it be so? My controller construct:

public function __construct()
{
    if(Auth::check()){
        print "yes";
    } else {
        print "no";
    };

    $this->middleware('auth');

}

public function index()
{
   print " index";
}

This prints out "no index". So Auth::check() return false, but index method is still raeched.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire