Skip to content

Requierd if other field is missing #142

Open

Description

@notom

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions