<?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'    => 'contact_message.validate_name_required',
        'name.max'        => 'contact_message.validate_name_max',
        'email.require'   => 'contact_message.validate_email_required',
        'email.email'     => 'contact_message.validate_email_email',
        'email.max'       => 'contact_message.validate_email_max',
        'content.require' => 'contact_message.validate_content_required',
        'content.max'     => 'contact_message.validate_content_max'
    ];
}
