Have you try with conditional validation
https://laravel.com/docs/8.x/validation#conditionally-adding-rules
I've been trying to work out how to do the following:
I have three fields which must be different from each other only if they contain a value. If they are empty or null then I don't want it checking.
I guess what I'm looking for is something like
differentIfNotNull:field2|differentIfNotNull:field3
or
differentIfNotNull:[field2,field3...etc]
Is there a way to do this? I already tried
"field1" => "nullable|different:field2|different:field3"
But if all fields are null or empty it throws a validation error complaining they are not different, which of course they aren't but I want to validation to be skipped if the field is empty.
Please or to participate in this conversation.