<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
// | Author: your name
// +----------------------------------------------------------------------
namespace {{namespace_start}}validate{{namespace_end}};

use plugin\saiadmin\basic\BaseValidate;

/**
 * {{menu_name}}验证器
 */
class {{class_name}}Validate extends BaseValidate
{
    /**
     * 定义验证规则
     */
    protected $rule =   [
{% for column in columns %}
{% if column.is_required == 2 and column.is_pk != 2 %}
        '{{column.column_name}}' => 'require',
{% endif %}
{% endfor %}
    ];

    /**
     * 定义错误信息
     */
    protected $message  =   [
{% for column in columns %}
{% if column.is_required == 2 and column.is_pk != 2 %}
        '{{column.column_name}}' => '{{column.column_comment}}必须填写',
{% endif %}
{% endfor %}
    ];

    /**
     * 定义场景
     */
    protected $scene = [
        'save' => [
{% for column in columns %}
{% if column.is_required == 2 and column.is_pk != 2 %}
            '{{column.column_name}}',
{% endif %}
{% endfor %}
        ],
        'update' => [
{% for column in columns %}
{% if column.is_required == 2 and column.is_pk != 2 %}
            '{{column.column_name}}',
{% endif %}
{% endfor %}
        ],
    ];

}
