validation icon indicating copy to clipboard operation
validation copied to clipboard

Requierd if other field is missing

Open notom opened this issue 3 years ago • 0 comments

So I have two fields - street and state. I want them to be required if the other is missing. So if the user enters the street OR the state OR both, the validation should pass. But if none of them are present should fail.

I tried: 'street ' => 'required_without:state', 'state' => 'required_without:street '

But if none of them is present the validation passes. Actually it passes anyhow - with both of them, without any of them, with one of them.

If the rules is only "required" the validation fails if they are not present.

I am using php 7.4

notom avatar Aug 19 '21 13:08 notom