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

johnw65's avatar

Login Question and Session Expiration

I have a listener in which after a successful login into an Oracle, I have to switch to database user and run some scripts.

  1. However, at this point, I like to flush out any sessions for this user and set session keys for this user. What is the best way of accomplish this?

  2. Also, if the session has expired, how can I redirect the user to the login page. Thanks.

0 likes
2 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

You can

$request->session()->regenerate();

prior to login.

You can redirect with something like:

return redirect('login')->with('status', $message);

Of course put your actual message into the variable.

johnw65's avatar

Thank you, I'm going to implement this.

Please or to participate in this conversation.