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

use think\Validate;

class IndexValidate extends Validate
{
    //定义规则
    protected $rule =   [
        'old_pwd'     => 'require',
        'new_pwd'     => 'require',
        'confirm_pwd' => 'require',
        'admin_id' => 'require',
        'admin_real_name' => 'require',
        'admin_pwd' => 'require',
        'agin_admin_pwd' => 'require',
        'admin_status' => 'require',
    ];

    //定义描述
    protected $message  =   [
        'old_pwd.require'      => '旧密码不能为空',
        'new_pwd.require'      => '新密码不能为空',
        'confirm_pwd.require'  => '确认密码不能为空',
        'admin_id.require'     => '管理员id不能为空',
        'admin_real_name.require' => '管理员姓名不能为空',
        'admin_pwd.require'    => '管理员密码不能为空',
        'agin_admin_pwd.require' => '确认密码不能为空',
        'admin_status.require' => '管理员状态不能为空',
        'admin_roles.require'  => '管理员权限不能为空',
        'admin_account.require'=> '管理员账号不能为空',
    ];

    //定义场景
    protected $scene = [
        'up_pwd' => ['old_pwd','new_pwd', 'confirm_pwd'],
        'info'   => ['admin_id'],
        'update'   => ['admin_id'],
        'create' => ['admin_real_name','admin_pwd','agin_admin_pwd','admin_status','admin_roles','admin_account'],
    ];
}
