<?php


namespace app\admin\validate;


class DepartmentValidate extends BaseValidate
{

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

    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'name' => '部门名称',
        'parent_id' => '父部门ID',
        'weight' => '权重',
        'status' => '状态',
        'remark' => '备注',
    ];

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

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

}