Im trying to work with Sessions in Laravel 5 Middleware, but they are not working.
To be specific - var_dump(Session::all());
at the start of handle method gives me array with one value - _tokken, then at the end of this method
Session::put('lang',$locale);
var_dump(Session::all());
Gives me array with two values, _tokken and my lang key, but after refresh its the same, as I understand there should be same result after second refresh.
I though maybe I have my middleware loaded before Session middleware, which was true, then I switched and now my Kernel.php looks like this -
protected $middleware = [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession',
'App\Http\Middleware\VerifyCsrfToken',
'App\Http\Middleware\Language',
];
So I ask - what am I doing wrong?
Edit: Digging in Illuminate\Session\Middleware\StartSession I found this -
//Note that the Laravel sessions do not make use of PHP "native" sessions in any way since they are crappy.
as a comment, so my testing with session_status() is not relavent.