Seeing as the previous session would be destroyed, I believe your best option will be to store the necessary information in some kind of database or data store, thus making it available at the time of the next login. Maybe something like Redis could meet your need.
Feb 22, 2022
4
Level 1
Get previous session data after successful login
Hi, I'm trying to achieve something like whenever someone login/registers I want to do something with the previous session id.
I saw laravel provides few auth events (https://laravel.com/docs/8.x/authentication#events)
// App\Listeners\LogSuccessfulLogin.php
public function handle($event)
{
// It works
dd(auth()->user());
// But I also want to get the old/previos session id.
}
Or please suggest some other solution to achieve this.
Thank you so much in advance :)
Please or to participate in this conversation.