Dec 19, 2022
0
Level 6
Trigger fail to $stopOnFirstFailure
I have a protected $stopOnFirstFailure = true; flag in my FormRequest class, which works fine for defined rules. However I also do some validation in:
public function withValidator($validator): void
{
$validator->after(function ($validator) {
...
}
}
How do I manually make the validation fail with an error and stop if a check has not passed?
Using $validator->errors()->add('username', 'error 1'); does not stop the validation.
Please or to participate in this conversation.