<?php
declare (strict_types = 1);

namespace app\index\validate;

use think\Validate;

class ContactUsMessageValidate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'name'    => 'require|max:64',
        'email'   => 'require|email|max:128',
        'content' => 'require|max:1024'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'name.require'    => '姓名不能为空',
        'name.max'        => '姓名不能超过:rule个字符',
        'email.require'   => '邮箱不能为空',
        'email.email'     => '邮箱格式不正确',
        'email.max'       => '邮箱不能超过:rule个字符',
        'content.require' => '问题不能为空',
        'content.max'     => '问题不能超过:rule个字符'
    ];
}
