Errorbag Is Always Empty in Laravel 5.2

ErrorBag is always empty in Laravel 5.2

As of v5.2.27, released on 2015-03-25, all routes in app\Http\routes.php are now in the web middleware group by default. If you have explicitly specified this middleware group inside your app\Http\routes.php file, you should remove it and that should resolve your issue.

Laravel 5.2 validation errors-- error bag empty

This seems to be related to an error running multiple versions of a similar site on Homestead. Destroying the box and rebuilding it fixed the issue.

Laravel MessageBag errors array is empty in view but with content if I kill script

If you get nothing in your case, than it means you have overridden your $errors object with something else or with empty object - check your code and data you pass to the views. Your code is perfectly valid and works good - I've tested it locally. Maybe, you passed empty $errors object to your subview, but in other views the correct object is used.

Laravel 5.2 Validation Error not appearing in blade

Try to remove web middleware if you're using 5.2.27 or higher. The thing is now Laravel automatically applies web middleware to all routes inside routes.php and if you're trying to add it manually you can get errors.

app/Providers/RouteServiceProvider.php of the 5.2.27 version now adds web middleware to all routes inside routes.php:

protected function mapWebRoutes(Router $router)
{
$router->group([
'namespace' => $this->namespace, 'middleware' => 'web',
], function ($router) {
require app_path('Http/routes.php');
});
}

Laravel - can't access to error bag

One thing that can cause this problem is adding web middleware manually to routes.php routes in Laravel 5.2.27 or higher.

Laravel 5.2 form validation not showing errors?

As of v5.2.27, released on 2015-03-25, all routes in app\Http\routes.php are now in the web middleware group by default. If you have explicitly specified this middleware group inside your app\Http\routes.php file, you need to remove it.

Why does not work withErrors in Laravel?

Try this in view:

@if(Session::has('error'))
{{ Session::get('error') }}
@endif


Related Topics



Leave a reply



Submit