I have a new site running Laravel 5.2 ( Laravel Framework version 5.2.39). NOTE: the routes file does NOT use a middleware group that is no longer needed and may cause this problem.
I have a simple method check ContactController store:
$this->validate($request, [
'ContactFirst' => 'required|max:25',
'ContactLast' => 'required|max:25',
'ContactRole' => 'required|max:25',
'ContactEmail' => 'email|max:255',
'ContactPhone' => 'max:255',
]);
When I intentionally refuse to check, the site is redirected back to the form, but the error bag is empty, so error information is not provided.
In the form view ( resources/contacts/new.blade.php), I put the following code from the documents and dump:
{{var_dump($errors)}}
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
The page (as I said) redirects back to the form and the inputs are populated. But it is $errorsempty and messages are not printed:
object(Illuminate\Support\ViewErrorBag)[285]
protected 'bags' =>
array (size=0)
empty