Files

43 lines
1.4 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace addon\haonav\validate;
use think\Validate;
/**
* Category 类
*
* @author ywxapp <admin@ywxapp.cn>
*/
class Category extends Validate
{
protected $rule = [
'title' => 'require|chsDash|max:50',
'pid' => 'integer|egt:0',
'icon' => 'max:50',
'summary'=> 'max:255',
'sort' => 'integer',
'status' => 'in:0,1',
];
protected $message = [
'title.require' => '分类名称不能为空',
'title.chsDash' => '分类名称只能是汉字、字母、数字或破折号',
'title.max' => '分类名称不能超过 50 个字符',
'pid.integer' => '上级分类必须是数字',
'pid.egt' => '上级分类不能为负',
'icon.max' => '图标标识过长',
'summary.max' => '简介不能超过 255 个字符',
'sort.integer' => '排序必须是数字',
'status.in' => '状态值不合法',
];
}