Laravel - Validation - Stopping On First Validation Failure
Sometimes you may wish to stop running validation rules on an attribute after the first validation failure. To do so, assign the
bail rule to the attribute:
$request->validate([ 'title' => 'bail|required|unique:posts|max:255', 'body' => 'required', ]);
In this example, if the
unique rule on the
title attribute fails, the
max rule will not be checked. Rules will be validated in the order they are assigned.