讨论数量:
public function rules()
{
return [
'product_data.*.category_name' => [
function ($attribute, $value, $fail) {
preg_match('/product_data\.(\d+)\.category_name/', $attribute, $m);
$index = $m[1];
if (empty($value)) {
return $fail('第' . $index+1 . '行商品分类不能为空。');
}
},
]
]
}
推荐文章: