94 lines
1.8 KiB
PHP
94 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace app\admin\validate\setting;
|
|
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* 分类表验证器
|
|
* Class CategoryValidate
|
|
* @package app\admin\validate\setting
|
|
*/
|
|
class CategoryValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'category_id' => 'require',
|
|
'pid' => 'require',
|
|
'cate_name' => 'require',
|
|
'path' => 'require',
|
|
'sort' => 'require',
|
|
'is_show' => 'require',
|
|
'level' => 'require',
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'category_id' => 'category_id',
|
|
'pid' => '父id',
|
|
'cate_name' => '分类名称',
|
|
'path' => '路径',
|
|
'sort' => '排序',
|
|
'is_show' => '是否显示',
|
|
'level' => '等级',
|
|
];
|
|
|
|
|
|
/**
|
|
* @notes 添加场景
|
|
* @return CategoryValidate
|
|
* @author likeadmin
|
|
* @date 2024/02/05 16:13
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->only(['pid','cate_name','path','sort','is_show','level']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return CategoryValidate
|
|
* @author likeadmin
|
|
* @date 2024/02/05 16:13
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['category_id','pid','cate_name','path','sort','is_show','level']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return CategoryValidate
|
|
* @author likeadmin
|
|
* @date 2024/02/05 16:13
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['category_id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return CategoryValidate
|
|
* @author likeadmin
|
|
* @date 2024/02/05 16:13
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['category_id']);
|
|
}
|
|
|
|
} |