1 Answer 1579 Views
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.
Leave a comment