Я изучаю Laravel 5, и я написал следующий код для входа пользователя.Я не использую функцию sendFailedLoginResponse в файле LoginController.php.Сейчас я пытаюсь отобразить сообщения об ошибках проверки с помощью этого кода:
@if($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
, но ничего не отображается.
rout.php
Auth::routes();
Route::group(['middleware' => 'auth'], function () {
Route::get('/', 'HomeController@index')->name('dashboard');
Route::get('logout', function () {
Auth::logout();
return redirect(route('dashboard'));
});
});
форма login.blade.php
<form id="loginForm" method="post" action="{{ url('login') }}" class="login-form">
{!! csrf_field() !!}
<div class="form-group form-group-username">
<label for="login-form-username">E-MAIL</label>
<input type="text" id="email" name="email" class="form-control" required="required" placeholder="E-mail adresinizi girin">
</div>
<!-- /.form-group -->
<div class="form-group form-group-password">
<label for="login-form-password">ŞİFRE</label>
<input id="password" type="password" name="password" class="form-control" autocomplete="off" required="required" placeholder="Lütfen şifrenizi girin">
</div>
<!-- /.form-group -->
<div class="form-group form-group-button">
<button type="submit" id="loginSend" class="button">Oturum Aç</button>
</div>
<!-- /.form-group -->
<div class="login-form-reset-link">
<a href="http://segments-demo.wearecodevision.com/reset-password/">
Şifrenizi mi unuttunuz? </a>
</div>
<!-- /.login-form-reset-link -->
</form>
Kernel.php
Файл Kernel.php выглядит следующим образом.Вы пропустили или слишком много строк?
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
];
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];