Support the ongoing development of Laravel.io →
Authentication Session Eloquent

I've been using this:


$query = $this->job->where('user_id', \Auth::user()->id)->get();

or

$query = $this->job->where('user_id', $this->request()->user()->id)->get();

But, by using any of these methods, my sessions seem to randomly expire, so it logs users out at random.

Is there a better, more efficient way to get user info to run in a query?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

clayhenry clayhenry Joined 1 Dec 2014

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.

© 2025 Laravel.io - All rights reserved.