Hello,
Ich Hava question. I startet a new project in Laravel where I like to use "modules". I know there is an package how does it. But I went quite far on my own. But at the moment Iam stuck with the problem that I can't use the session data in my modules. What do I miss?
I created a modules folder in there are the modules with an own ServiceProvider file where I register all the stuff. That works fine. But how can I access the session data in an controller in one of these modules?
greets
Steven
Back
•
Have you configured your middleware correctly? Is the session started at all?
•
Helllo Lukas,
no, I didnt configure any middleware. If I use any file in the app folder it works. If I use any file in my modules folder (its in the root folder) I can't see the session data.
•
StartSession needs to be applied to get access to the session. This middleware is part of the 'web' middleware stack by default. Therefore, your controllers and routes registered in web.php automatically have access to it without further configuration. With modules, however, you need to apply this middleware stack manually.