4位数字的Laravel请求验证,这也不是重新列出参数
我想验证仅适用于4位数字的PIN代码,不需要它。 表示PIN代码仅为4位数字。例如1234、8675,或者如果用户未输入任何数字来输入类型,则用户提交表单。如果用户未输入PIN代码,我想给数据库的默认值1111。
I want to validate a pin code that is just for 4 digits and it should not be required.
means pin code is only 4 digits. like 1234, 8675, or if the user does not enter any digits to Pincode input type let the user submit the form. I want to give the database's default value 1111 if the user doesn't enter the pin code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以验证允许
pin
为null
的请求(或使用表单请求),否则否则验证它是4位数字。然后,您可以从输入或后备到1111。
的默认值获取pin
You can validate the request (or use a form request) that allows
pin
to benull
otherwise validates it is a 4 digit number. You can then get thepin
from the input or fallback to the default value of1111.