<?php


namespace app\admin\validate;


class CategoryValidate extends BaseValidate
{

     /**
      * 设置校验规则
      * @var string[]
      */
    protected $rule = [
        'id' => 'require',
        'category_id' => 'integer',
        'name' => 'require|length:1,100',
        'weight' => 'require|integer|min:0',
        'status' => 'min:0',
    ];

    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'category_id' => '分类id',
        'name' => '分类名称',
        'weight' => '权重',
        'status' => '状态',
        'language_code' => '语言',
    ];


    /**
     * @notes 添加场景
     */
    public function sceneAdd()
    {
        return $this->only(['category_id', 'name', 'weight', 'status', 'language_code']);
    }


    /**
     * @notes 编辑场景
     */
    public function sceneEdit()
    {
        return $this->only(['category_id', 'name', 'weight', 'status', 'language_code']);
    }

    public function sceneId()
    {
        return $this->only(['id']);
    }

}