@foreach($errors->all('login') as $error)
{{ $error }}
@endforeach
public function AuthUser(Request $request) {
$this->validate($request, [
'login' => 'min:6|max:15',
'password' => 'min:6|max:20',
]);
if($validator->fails()) {
return Redirect::back()->withErrors($validator, 'login');
}
$login = $request->input('login');
$password = Hash::make($request->input('password'));
if (Auth::attempt(['login' => $login, 'password' => $password])) {
return Redirect::to('user/' . Auth::id());
} else {
return Redirect::back();
}
}
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all('login') as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
if($validator->fails()) {
return Redirect::back()->withErrors($validator, 'login');
}