123456789101112131415161718192021222324252627 |
- <?php
- namespace app\admin\validate\intelligence;
- use think\Validate;
- class CategoryValidate extends Validate
- {
- protected $rule = [
- 'category_name' => 'require|max:20',
- 'category_id' => 'require',
- 'category_pid' => 'require',
- ];
- protected $message = [
- 'category_name.require' => '分类名称不能为空',
- 'category_id.require' => '分类id不能为空',
- 'category_name.max' => '分类名称不能超过20字',
- 'category_pid' => '父级id不能为空',
- ];
- //场景
- protected $scene = [
- 'create' => ['category_name','category_pid'],
- 'update' => ['category_id'],
- 'info' => ['category_id']
- ];
- }
|