Laravel 8 in:foo,bar,…
验证字段必须包含在给定的值列表中。由于此规则通常要求您 implode
数组,因此可以使用 Rule::in
方法流畅地构造规则:
use Illuminate\Validation\Rule;
Validator::make($data, [
'zones' => [
'required',
Rule::in(['first-zone', 'second-zone']),
],
]);
验证字段必须包含在给定的值列表中。由于此规则通常要求您 implode
数组,因此可以使用 Rule::in
方法流畅地构造规则:
use Illuminate\Validation\Rule;
Validator::make($data, [
'zones' => [
'required',
Rule::in(['first-zone', 'second-zone']),
],
]);