You cannot use the session service before the Illuminate\Session\Middleware\StartSession middleware is called. This middleware is by default in the 'web' group and is executed after the global middlewares. In other words, if you want to use session in the global middleware you will have to put the Illuminate\Session\Middleware\StartSession middleware in the global middleware stack and before your custom middleware.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community