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

Validation of *oneOf* #10

Open
codedge opened this issue May 9, 2019 · 0 comments
Open

Validation of *oneOf* #10

codedge opened this issue May 9, 2019 · 0 comments

Comments

@codedge
Copy link

codedge commented May 9, 2019

Hi,

is there any way to validate with oneOf from the Respect validation package?

v::oneOf(
  v::key('ip', v::notBlank()),
  v::key('q', v::notBlank()->alpha()
)

Of course this works but does not contain validation messages like the validator method.

I'd like to pass this to the validator to get the error messages in case there are some.

$validator = $this->validator->validate($request, [
            'ip' => v::optional(v::ip()),
            'country' => v::optional(v::countryCode())->in($this->country_codes),
            v::oneOf(
                v::key('ip', v::notBlank()),
                v::key('q', v::notBlank()->alpha())
            )
        ]);

Thanks

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