<?php


namespace app\admin\validate;


class RoleValidate extends BaseValidate
{

     /**
      * 设置校验规则
      * @var string[]
      */
    protected $rule = [
        'id' => 'require',
        'name' => 'require|length:1,50',
        'avatar' => 'length:0,200',
        'desc' => 'length:0,200',
        'menu_id' => 'require|array',
    ];

    /**
     * 参数描述
     * @var string[]
     */
    protected $field = [
        'id' => 'id',
        'name' => '角色名称',
        'avatar' => '头像',
        'desc' => '角色描述',
        'menu_id' => '菜单ID',
    ];

    /**
     * @notes 编辑场景
     */
    public function sceneEdit()
    {
        return $this->only(['name', 'avatar', 'desc', 'menu_id']);
    }

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

}