作者 lyh

gx

... ... @@ -40,16 +40,16 @@ class ProductRequest extends FormRequest
'route' => 'required|max:200',
'gallery' => ['required', 'array'],
'icon' => 'required|array',
'attrs' => ['array', function ($attribute, $value, $fail) {
foreach ($value as $v) {
if (empty($v['key'])) {
$fail('产品属性名不能为空');
}
if (empty($v['value'])) {
$fail('产品属性值不能为空');
}
}
}],
// 'attrs' => ['array', function ($attribute, $value, $fail) {
// foreach ($value as $v) {
// if (empty($v['key'])) {
// $fail('产品属性名不能为空');
// }
// if (empty($v['value'])) {
// $fail('产品属性值不能为空');
// }
// }
// }],
'category_id' => 'required',
'intro' => 'required|max:500',
'content' => 'required',
... ... @@ -72,8 +72,8 @@ class ProductRequest extends FormRequest
'route.max' => '产品链接不能超过200个字符',
'gallery.required' => '请上传产品图片',
'gallery.array' => '产品图片格式异常',
'attrs.required' => '请添加产品参数',
'attrs.array' => '产品参数格式异常',
// 'attrs.required' => '请添加产品参数',
// 'attrs.array' => '产品参数格式异常',
'icon.required' => '图标不能为空',
'category_id.required' => '请选择分类',
'intro.required' => '请输入短描述',
... ...