0

Laravel 5.4 Session flash messages not working after adding all routes in custom middleware

here my route file code.

Route::group(['middleware' => 'loadsession'], function () {



});
Dilip Hirapara
  • 14,810
  • 3
  • 27
  • 49
Zain
  • 23
  • 8
  • 1
    can you put up the code from the `loadsession` middleware? is that route group in your `web.php` routes files? – lagbox Oct 16 '19 at 04:13
  • laravel 5.4 has a problem working with session in the middleware. related post. https://stackoverflow.com/questions/29797952/session-not-working-in-middleware-laravel-5 – Julius Limson Oct 16 '19 at 06:52
  • StartSession middleware hasn't booted before you're trying to use your loadsession middleware. – Julius Limson Oct 16 '19 at 07:06

1 Answers1

2

Add web middleware to your route which persist your session data

Route::group(['middleware' => ['loadsession','web']], function () {


});
Achraf Khouadja
  • 6,119
  • 4
  • 27
  • 39
royallife
  • 98
  • 7
  • thanks, @royallife, but after adding the web, I have another error "web class not found"? – Zain Oct 18 '19 at 04:12