<?php
declare (strict_types = 1);

namespace app\admin\validate\v1;

use think\Validate;

class LoginValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'username' => 'require',
        'password' => 'require',
        'captcha'  => 'max:6',
        'token'    => 'requireWith:captcha'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'username.require'  => '用户名不能为空',
        'password.require'  => '密码不能为空',
        'captcha.captcha'   => '验证码不能为空',
        'token.requireWith' => '验证码token不能为空'
    ];
}
