Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为字符串添加一个验证规则,以完全匹配正则表达式模式中提供的任何字符串。例如,status必须完全是“已批准”或“待定”,仅此而已。
status
'status' => 'required|regex:[???]'
You can just use the in validation rule.
in
in:foo,bar,... The field under validation must be included in the given list of values.
in:foo,bar,...
The field under validation must be included in the given list of values.
In your case that would be:
'status' => 'required|in:Approved,Pending'