nk-lihaink-cn/app/admin/validate/ArticleCateCheck.php
2021-07-26 17:41:59 +08:00

34 lines
826 B
PHP

<?php
/**
* @copyright Copyright (c) 2021 勾股工作室
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.gougucms.com
*/
namespace app\admin\validate;
use think\Validate;
class ArticleCateCheck extends Validate
{
protected $rule = [
'title' => 'require|unique:article_cate',
'pid' => 'require',
'id' => 'require',
'field' => 'require',
];
protected $message = [
'title.require' => '名称不能为空',
'pid.require' => '父级分类为必选',
'title.unique' => '同样的记录已经存在',
'id.require' => '缺少更新条件',
'filed.require' => '缺少要更新的字段名',
];
protected $scene = [
'add' => ['title', 'pid'],
'edit' => ['id', 'field', 'title.unique'],
];
}