All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 5s
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\admin\validate\v1;
|
|
|
|
use think\Validate;
|
|
|
|
class ProductCompatPartsValidate extends Validate
|
|
{
|
|
/**
|
|
* 定义验证规则
|
|
* 格式:'字段名' => ['规则1','规则2'...]
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $rule = [
|
|
'language_id' => 'require|integer',
|
|
'name' => 'max:128'
|
|
];
|
|
|
|
/**
|
|
* 定义错误信息
|
|
* 格式:'字段名.规则名' => '错误信息'
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $message = [
|
|
'id.require' => 'ID不能为空',
|
|
'id.integer' => 'ID必须为整数',
|
|
'language_id.require' => '语言ID不能为空',
|
|
'language_id.integer' => '语言ID必须是整数',
|
|
'name.max' => '类型名称不能超过:rule个字符'
|
|
];
|
|
|
|
// 新增场景
|
|
protected function sceneAdd()
|
|
{
|
|
return $this->remove("id", "require|integer");
|
|
}
|
|
|
|
// 编辑场景
|
|
protected function sceneEdit()
|
|
{
|
|
return $this->append("id", "require|integer");
|
|
}
|
|
}
|