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

use think\Validate;

class RoleValidate extends Validate
{
    protected $rule =   [
        'role_name'  => 'require|max:20',
        'role_id'    => 'require',
        'role_rules' => 'require',
    ];

    protected $message  =   [
        'role_name.require' => '角色名称不能为空',
        'role_rules.require'=> '身份管理权限不能为空',
        'role_id.require'   => '角色id不能为空',
        'role_name.max'  => '角色名称不能超过20字'
    ];

    //场景
    protected $scene = [
        'create'   => ['role_name'],
        'update'   => ['role_id','role_name'],
        'info'     => ['role_id']
    ];
}
