Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

laracoft's avatar
Level 27

Where is auth()->user() remembered?

Where/how does Laravel remember the auth()->user() across requests?

In my config/auth.php, I can see the driver is session and in my .env, I can see SESSION_DRIVER is file.

I thought it could be inspected using session()->all(), but there was almost nothing in there except for a _token, any ideas

0 likes
8 replies
Snapey's avatar
Snapey
Best Answer
Level 122

The user is identified from their session, and looked up in the database

abelzannou's avatar

I'm using Laravel Sanctum API and I am a Laravel learner. I want help on how to make a multiple user authentication system (user, admin, master_admin) as well as the management of their role. The user can modify his profile information, change his password. The administrator, in addition to the user's roles, can create a user, modify his own information. The Master Administrator, in addition to the user and administrator roles, can delete users and administrators, give them roles and others...I would like you to explain it to me step by step Please

Snapey's avatar

@abelzannou Don't do it

Users are Users. Its only after you have authenticated them that you can decide what they are allowed to do. You do not need different types of user to do this.

If in doubt, start your own question instead of hijacking a totally unrelated question.

abelzannou's avatar

@Snapey ok thank you for your answer Please can you give me more explanation to show me how i can make it( I need the different step that i can follow to make it) Please i need your help

Please or to participate in this conversation.