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

Nemiq's avatar

Store session data after successful login

Hello,

I'm using the built in Auth functionality and would like to store some session data after successful login (Time zone etc.). Is there any simple way to accomplish this?

Br, Joakim

0 likes
3 replies
Nemiq's avatar

My problem is not how to set the session variables, but where. After a bit of reading it seems the easiest solution would be to set the session data in the 'successful login' event?

willvincent's avatar
Level 54

The successful login event seems reasonable yes... in fact I'd probably say that's the "right" way to do it. Implement a listener and add your session data in the handle method...

namespace App\Listeners;

use Illuminate\Auth\Events\Login;

class PopulateSession
{

    public function handle(Login $login)
    {
    // Populate your extra session data here
    }

}

Please or to participate in this conversation.