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.

尝试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.