Laravel 5.2不返回错误数组 [英] Laravel 5.2 Not returning error array

查看:316
本文介绍了Laravel 5.2不返回错误数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习LAVERAL 5.2和在我的routes.php文件如下:

I am trying to learn Laveral 5.2 and have the following in my routes.php:

Route::group(['middleware' => ['web'] ], function()     {
Route::get('/', function () {
        return view('welcome');         });

Route::post('/signup', [ 'uses' =>'UserController@postSignUp',
    'as' => 'signup']);
Route::post('/signin', [    'uses' => 'UserController@postSignIn',
            'as' => 'signin']);

Route::get('/dashboard',['uses' =>'UserController@getDashboard',
            'as' => 'dashboard' ]);
});

在我的控制,我有一些验证:

In my Controller I have some validation:

$this->validate( $request, [
        'email' => 'required|email|unique:users',
        'first_name' =>'required|max:120',
        'password' => 'required|min:4'
        ]);

在我的登录屏幕我有以下几点:

and in my logon screen I have the following:

@if (count($errors) > 0 )
<div class="row">
     <div class="col-md-12">
    <ul>

        @foreach($errors->all() as $error)
            <li>{{ $error }}</li>
        @endforeach
    </ul>
    </div>
 </div>

错误数组似乎永远是空的。

The error array seems to always be empty.

推荐答案

尝试<一个href=\"http://stackoverflow.com/questions/36784253/laravel-5-2-validation-error-not-appearing-in-blade\">remove如果你使用Laravel 5.2.27和更高网络中间件。 网​​站中间件自动添加现在所有的路线,如果你想手动添加它,它会导致类似的问题,以你的。

Try to remove web middleware if you're using Laravel 5.2.27 and higher. web middleware is adding automatically now to all routes and if you're trying to add it manually, it causes problems similar to yours.

它已经帮助许多人解决类似的问题。我希望它会帮助你。

It already helped many people to solve similar problems. I hope it'll help you too.

这篇关于Laravel 5.2不返回错误数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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