Why do you need user data in session when it is always loaded via auth() ?
Comment out the forget statement. its redundant.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I am using a middleware that check if the user stored his information in session.
This middleware works fine and the user model is correctly stored in session, using :
Session()->put('user', $user)
When the user update his information, I need to refresh it in the session.
So I do :
// Update user in DB...
// Then
Session()->forget('user')
Session()->put('user', $user)
// dd(session()->all()) : here I can see the new information stored
But when I redirect the user, the new information do not persist... I checked the middleware and I do not think it delete any data...
Thanks for you help!
Please or to participate in this conversation.