這裏是我的login.blade.phpLaravel 5.5登錄錯誤沒有顯示出來
@if(Session::get('errors')||count($errors) > 0)
@foreach ($errors->all() as $error)
<h1>{{ $error }}</h1>
@endforeach
@endif
這裏是我的LoginController.php:
protected function sendFailedLoginResponse(Request $request)
{
return redirect()->back()
->withInput($request->only($this->username(), 'remember'))
->withErrors([
$this->username() => 'ERRORS',
]);
}
這裏是我的web.php(路線)
// I am customizing the login to do extra checks,
// but I still need the basic auth scaffolding.
Auth::routes();
...
Route::group(['middleware' => 'web'], function() {
Route::view('/login', 'auth.login');
Route::post('/login', 'Auth\[email protected]')->name('login');
});
當我試圖用錯誤的用戶它顯示視圖中沒有錯誤登錄,我算什麼我做錯了?
更新:
我試圖改變login.blade.php,作爲@Seva卡拉什尼科夫認爲,沒有運氣。
我也試過@Akshay Kulkarni建議沒有運氣。
它應該是'$ errors-> any()' – Ohgodwhy
下面是來自Laravel Basic Auth Views的示例:https://github.com/drbyte/laravel-basic-auth-views/blob/master/resources/views /auth/login.blade.php –
和[這裏是來自documentaion的示例](https://laravel.com/docs/5.5/validation#quick-displaying-the-validation-errors)。它應該是'$ errors-> any()'。查看留言包始終可用。 – Ohgodwhy