Disconnect a session in Laravel

I am developing an application to protect against legacy applications, so I donโ€™t need sessions at all.

I deleted the line with \Illuminate\Session\Middleware\StartSession::class, from protected $middleware = []; in \app\Http\Kernel.php I also deleted the SESSION_DRIVE file from .env . But I get the following error:

 RuntimeException in Request.php line 756: Session store not set on request. 

How to disconnect sessions in Laravel 5?

+5
source share
1 answer

Remove the Illuminate\Foundation\Http\Middleware\VerifyCsrfToken and Illuminate\View\Middleware\ShareErrorsFromSession from your middleware. These features require sessions.

Not required, but I probably also suggest setting your session driver to array , just so that if any functions you use require session functions, they can work, at least without errors. The array driver, as it suggests, stores all session data in a standard PHP array, so everything will be erased as soon as the request is complete.

+12
source

All Articles