hmmm.. perhaps you have some weird routes. Since you are coming from 5.2 there was a time where web
middleware was defined in the routes, and it isn't now..
Give this a quick watch (not spam i swear) https://laracademy.co/videos/laravel-5-intermediate-series/session-woes-in-laravel
see if that is your problem
Its not you at fault. As always, this new Laravel release has breaking changes.
Now somehow it was decided you cannot use sessions everywhere in your application.
Check the upgrade guide: https://laravel.com/docs/5.3/upgrade
Changes to session actually occurred in Laravel 5.2.4* . I don't know the exact version but I noticed after upgrading to the newest 5.2 the session facade was no longer working for me, specifically in blade templates. Naturally this also affected V5.3. The solution for me was to swap from the facade: Session::put('data', $array);
calls to the global session helper session(['data', $array]);
. If you are making these calls within your controller, I recommend using the $request
object instead like $request->session()->put('data', $array);
. I'm still looking for the PR on the framework that caused this change, but you can read about the global session helper here: https://laravel.com/docs/5.3/session#using-the-session
Also, if these calls were being made in your __construct()
for a controller, they will no longer function properly since middleware has been changed not allow session variables to be initialized there.
I am getting same issue in laravel 5.3. I have generated login using scaffolding. It works on login and dashboard page. I am unable to find auth on other routes. It is showing session null on other routes.
Apparently in 5.3, you're no longer about to access the authenticated user in controller constructors, because the middleware hasn't run yet.
See the Controllers section of the upgrade guide.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community