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

二选一参数必选该用哪个验证器? #49

Open
ZhangChengLin opened this issue Sep 25, 2021 · 0 comments
Open

二选一参数必选该用哪个验证器? #49

ZhangChengLin opened this issue Sep 25, 2021 · 0 comments
Labels

Comments

@ZhangChengLin
Copy link
Contributor

requiredIf
requiredUnless
requiredWith
requiredWithAll
requiredWithout
requiredWithoutAll

比如注册表单中的手机号和邮箱,选填其一。
该如何设置必填项?下面这种可以吗?

    ['email', 'requiredWithoutAll', ['phone']],
    ['email', "string:6,50", 'filter' => $filter],
    ['email', 'email'],

    ['phone', 'requiredWithoutAll', ['email']],
    ['phone', "fixedSize:11", 'filter' => $filter],
    ['phone', 'regexp', "{$regexp['phone']}"],

这种感觉提示结果不是预期想要的二选一提示。
只会提示最后一个被验证的字段提示

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

No branches or pull requests

2 participants