如何在 Laravel 中验证阵列?
我尝试在Laravel中验证阵列POST:
$validator = Validator::make($request->all(), [
"name.*" => 'required|distinct|min:3',
"amount.*" => 'required|integer|min:1',
"description.*" => "required|string"
]);
我发送空的POST并得到这个作为.这意味着验证是正确的,但事实并非如此。if ($validator->fails()) {}
False
如何在 Laravel 中验证阵列?当我提交表格时input name="name[]"