<?php
namespace app\admin\validate\category;

use think\Validate;

class CategoryValidate extends Validate
{
    protected $rule =   [
        'category_name'  => 'require',
        'category_id'    => 'require',
        'category_type'   => 'require',
        'category_open_type'   => 'require',
        'category_recommend'   => 'require',
        'category_pid'   => 'require',
    ];

    protected $message  =   [
        'category_name.require'   => '分类名称不能为空',
        'category_pid.require'    => '分类父级id不能为空',
        'category_type.require'   => '类型不能为空',
        'category_open_type.require'  => '打开页面类型不能为空',
        'category_recommend.require' => '是否首页推荐不能为空',
        'category_id.require'     => '分类id不能为空',
    ];

    //场景
    protected $scene = [
        'create'   => ['category_name','category_pid','category_type','category_open_type','category_recommend'],
        'update'   => ['category_id'],
        'info'     => ['category_id']
    ];
}
