在Laravel 5.2中ErrorBag始终为空 [英] ErrorBag is always empty in Laravel 5.2

查看:84
本文介绍了在Laravel 5.2中ErrorBag始终为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个新的Laravel项目,并且在调试表单请求的错误时,我注意到我的ErrorBag始终为空.即使在控制器中,$validator->fails()返回true.我尝试了在互联网上找到的所有解决方案,但没有任何效果.

I was creating a new Laravel project and when debugging the errors of a form request, I noticed that my ErrorBag was always empty. Even when in the controller $validator->fails() returned true. I tried every solution I found on the internet but nothing worked.

即使使用composer创建新项目(如此处所述),将所有字段保留为空时,box auth系统将有一个空错误包.

Even when creating a fresh project with composer (as described here) my out of the box auth system has an empty error bag when leaving all the field empty.

是的,所有路由都使用中间件组网络.

And yes, all the routes are using the middleware group web.

任何想法导致此问题的原因是什么? (Session :: put()和Session :: get()正常工作)

Any ideas what is causing this problem? (Session::put() and Session::get() are working)

推荐答案

自2015年5月25日发布的v5.2.27起,默认情况下,app\Http\routes.php中的所有路由现在都位于web中间件组中.如果您在app\Http\routes.php文件中明确指定了该中间件组,则应将其删除,这样可以解决您的问题.

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中ErrorBag始终为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆