refactor: 修改产品校验规则

This commit is contained in:
2025-02-11 10:18:48 +08:00
parent 024cc0352e
commit 1da92aeeb0

View File

@@ -14,6 +14,7 @@ class ProductValidate extends Validate
* @var array
*/
protected $rule = [
'language_id' => 'require|integer',
'category_id' => 'integer',
'spu' => 'require|max:255',
'name' => 'require|max:125',
@@ -41,6 +42,8 @@ class ProductValidate extends Validate
* @var array
*/
protected $message = [
'language_id.require' => '语言ID不能为空',
'language_id.integer' => '语言ID必须为整数',
'category_id.integer' => '分类ID必须为整数',
'spu.require' => 'spu不能为空',
'spu.max' => 'spu不能超过255个字符',
@@ -77,6 +80,7 @@ class ProductValidate extends Validate
public function sceneUpdate()
{
return $this->only([
'language_id',
'category_id',
'spu',
'name',