I'm trying to add a custom rule for validator, but it's not working at all, the function is not even called. I took this from documentation(https://laravel.com/docs/5.4/validation#custom-validation-rules):
In AppServiceProvider::boot I have this:
Validator::extend('foo', function ($attribute, $value, $parameters, $validator) {
return false;
});
and In my controller I have this:
$validator = Validator::make($request->all(), [
'myField' => 'foo',
]);
The validator doesn't fail. What am I doing wrong?