Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requierd if other field is missing #142

Open
notom opened this issue Aug 19, 2021 · 0 comments
Open

Requierd if other field is missing #142

notom opened this issue Aug 19, 2021 · 0 comments

Comments

@notom
Copy link

notom commented Aug 19, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant