<?php  namespace  App\Http\Requests\Manager;

use App\Http\Requests\BaseRequest;

/**
 * 权限组管理
 *
 * */
class AuthGroup extends BaseRequest{

    /**
     *
     * @return  array
     */
    public  function  rules(){
        // 编辑时排除ID 
        $id			           = request('id',0);
        // 规则
        return [
            'name'             => 'required|unique:auth_group,name,'.$id,
            'id'               => 'required|integer|gt:0',
            'group_id'         => 'required|integer|gt:0',
        ];
    }

    // 场景列表
    protected   $scenes         = [
		'add'  		            => ['name'],
        'edit'  		        => ['id','name'],
        'get_detail'            => ['id'],
        'set_status'  		    => ['id'],
        'get_access'            => ['group_id'],
        'set_access'            => ['group_id'],
	];

    /**
     *
     * @return  array
     */
    public  function  messages()    {
        return [
            'name.required'         => '请输入权限组名称',
            'name.unique'           => '权限组名称已存在',
            'id.required'           => 'ID未知',
            'id.integer'   	        => 'ID格式错误',
            'id.gt'   		        => 'ID格式错误',

            'group_id.required'     => '请选择权限组',
            'group_id.integer'   	=> '权限组ID格式错误',
            'group_id.gt'   		=> '权限组ID格式错误',
        ];
    }

}
