You have to make sure that in app/Http/Kernel.php in middlewareGroups for web you have:
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
in this array. Compare this with https://github.com/laravel/laravel/blob/master/app/Http/Kernel.php
EDIT
It seems you need to add 'middleware' => 'web' for the route you are using or put \Illuminate\View\Middleware\ShareErrorsFromSession::class, in the $middleware properties array
or
Inside the routes.php file, try creating your routes in the next block
Route::group(['middleware' => ['web']], function () {
UPDATE FOR NEW LARAVEL APPLICATION VERSIONS
Remember that you may run into problems if you use web middleware twice. A change was made to the Laravel 5.2.27 application (do not confuse it with the Laravel base that you are currently using - you can use the Laravel framework, for example 5.2.31, but have a Laravel application in version 5.2. 24), in which the web intermediate software is applied automatically for all routes. Therefore, in case of problems, you should open the app/Providers/RouteServiceProvider.php and check its contents.
You can compare it here too:
In case you have a newer version (which applies web middleware automatically), you should no longer use the web middleware in routes.php , or you should change your RouteServiceProvider method RouteServiceProvider that you do not use the group web middleware, Otherwise If this provider automatically uses the middleware group web , and you use it also in routes.php , you can get very unexpected results.
Marcin NabiaΕek Dec 24 '15 at 2:31 on 2015-12-24 14:31
source share