It's quite easy to retrieve session in laravel constructor. All you need to do is move these two lines
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
from your protected $middlewareGroups = [] array to your protected $middleware= [ ] array in your App\Http\kernel.php.
Once you move these lines, you can easily retrieve session in your constructor.
Sign in to help the community by answering this question.
Log In to Answer
Comments