Skip to content

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

@ZhangChengLin

Description

@ZhangChengLin
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']}"], 

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions