Were your routes cached prior to using the 'web' middleware?
Session store not set on request.
Hello guys,
Just decided to upgrade one of my projects to 5.2 (from 5.1) as I wanted to continue working on it, I've followed the 5.2 upgrade and believe have everything in order. But I'm getting an error:
RuntimeException in Request.php line 852: Session store not set on request.
After some digging around, the majority of people are suggesting it's because the web middleware is not being used - but I believe I am.
Route::group(['middleware' => ['web']], function () {
/* -------------------------------------
#. App
------------------------------------- */
Route::get('/', ['as' => 'home', 'uses' => 'ProductsController@index']);
/* -------------------------------------
#. Products
------------------------------------- */
Route::get('products/popular', ['as' => 'products.popular', 'uses' => 'ProductsController@popular']);
Route::resource('products', 'ProductsController', ['only' => ['index', 'show']]);
Route::post('products/search', ['as' => 'products.search', 'uses' => 'ProductsController@search']);
/* -------------------------------------
#. Categories
------------------------------------- */
Route::resource('categories', 'CategoriesController', ['only' => ['index', 'show']]);
/* -------------------------------------
#. Authentication
------------------------------------- */
Route::get('auth/login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@getLogin']);
Route::post('auth/login', ['as' => 'auth.attempt', 'uses' => 'Auth\AuthController@postLogin']);
Route::get('auth/logout', ['as' => 'auth.logout', 'uses' => 'Auth\AuthController@getLogout']);
Route::get('profile', ['as' => 'auth.profile', 'uses' => 'Auth\AuthController@getProfile']);
Route::get('auth/register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@getRegister']);
Route::post('auth/register', ['as' => 'auth.register.attempt', 'uses' => 'Auth\AuthController@postRegister']);
Route::group(['prefix' => 'admin', 'middleware' => 'permitted'], function() {
// admin routes - removed for thread to decrease crap :)
});
});
My app/Http/Kernel.php contains the Middleware group too...
protected $middlewareGroups = [
'web' => [
\Corespawn\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Corespawn\Http\Middleware\VerifyCsrfToken::class
],
'api' => [
'throttle:60,1',
],
];
At least to my knowledge and per the threads I've come across, this should be correct?
But I still get the error. Any ideas?
I'd rather have not, but just ended up creating a new 5.2 project and moving everything into it.
Please or to participate in this conversation.