我将提交一个一维数组的值以在laravel 5.6上进行处理。
但它只验证值而不是索引,请分享您的想法和评论。
quantity[4]:11
quantity[2]:14
我需要验证索引和值,索引应该存在于股票id中,值必须是整数且最小为1。
我已经尝试过。
public function rules()
{
$rules = [
'quantity.*' => 'exists:stocks,id',
'quantity' => 'required|integer|min:1',
];
return $rules;
}
但它只验证值而不是索引,请分享您的想法和评论。