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

After digging a bit, I discovered my problem.

First, I dropped using Auth::check() and began using Auth::user(). When I called Auth::user(), I discovered I had set the incorrect value in my Eloquent model for what to return for getAuthIdentifier. I've since made it "return $this->attributes[$this->primaryKey]".

For those interested, this is my Eloquent model that I'm using for authentication. I highlighted the method.

Some of the problems related to Auth::check() I believe was due to my use of dd() during debugging. I wasn't allowing the request to complete and thus wasn't writing back to my session appropriately. I'm not 100% certain on that, but I did see my session keys disappearing in Redis. That stopped happening once I returned a value instead of calling dd() and exiting the application.

Last updated 8 years ago.

Sign in to participate in this thread!


Your banner here too?

kreeves kreeves Joined 20 May 2015


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.

© 2023 - All rights reserved.