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

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.

0

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

0

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.
0

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.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.