Support the ongoing development of →
Requests Session
Last updated 5 months ago.

Session expiration probably means that the user is logged out. In this case you can specify middleware on your routes that will redirect users if the route requires you to be logged in. That will redirect them to auth/ pages but user will not see any notification. You can of course edit your app/Http/Middleware/Authenticate file, @handle method and use

Session::put('message', 'You need to be logged in');

And on your auth/login page use

echo Session::get('message');
Last updated 7 years ago.

Hey, thank you for your answer. I added this at the beginning of the @handle method in the Authenticate middleware :

if (!Auth::check()) {
  Session::flash('message', trans('errors.session_label'));
  Session::flash('type', 'warning');

  return redirect()->route('home');


Don't know if there's a better way, but it works, thanks !


Sign in to participate in this thread!


Your banner here too?

SynRJ synrj Joined 3 Sep 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.