Support the ongoing development of →
Authentication Session Eloquent
Last updated 1 year ago.

Here is my understanding... I could be wrong.. Im fairly new to laravel.

Auth::check only works...

You have to do Auth::attempt() AND redirect to a route. (this is where the session is set on redirect)

Once you do that your Auth::check() will work.


What version are you using (Laravel 4 or the upcoming 5)


The problem was that I was wrongly overwriting the getAuthIdentifier()-method in my User class

public function getAuthIdentifier()
        return $this->email; //should be changed to
        return $this->id;

removing all overwritten methods also solves the problem

Last updated 9 years ago.

In my case, this command made Auth::check() work.

php artisan cache:clear

But a few days later, it doesn't work anymore. I tried to protect some URLs, so that I used auth middleware for a group of URLs. For some hours, everything's fine. But Auth::check() returns false again, though I did nothing.

Is that a bug of Laravel 5?

Last updated 8 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.