I am trying to get validation errors to show up in Laravel.
I have a UserController set up like so:
The errors block should be:
@if (count($errors) > 0)
@foreach ($errors->all() as $error)
- {{ $error }}
@endforeach
@endif
Assuming you're using Bootstrap for the alerts.
You also don't have $validator
defined. You need to do something like this:
$validator = Validator::make($request->all(), [
'email' => 'required|unique:users|email|max:255',
]);
Instead of $this->validate()
.
That should do it.