智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

54 lines
2.3 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\validate\document;
use core\base\BaseValidate;
/**
* 文档数据源配置验证器
* Class DocumentDataSource
* @package app\validate\document
*/
class DocumentDataSource extends BaseValidate
{
protected $rule = [
'contract_id' => 'require|integer|gt:0',
'placeholder' => 'require|max:255',
'table_name' => 'max:100',
'field_name' => 'max:100',
'field_type' => 'in:string,integer,decimal,datetime,text',
'is_required' => 'in:0,1',
'default_value' => 'max:1000',
'configs' => 'require|array'
];
protected $message = [
'contract_id.require' => '合同ID不能为空',
'contract_id.integer' => '合同ID必须为整数',
'contract_id.gt' => '合同ID必须大于0',
'placeholder.require' => '占位符不能为空',
'placeholder.max' => '占位符长度不能超过255个字符',
'table_name.max' => '表名长度不能超过100个字符',
'field_name.max' => '字段名长度不能超过100个字符',
'field_type.in' => '字段类型必须为:string,integer,decimal,datetime,text中的一种',
'is_required.in' => '是否必填必须为0或1',
'default_value.max' => '默认值长度不能超过1000个字符',
'configs.require' => '配置数据不能为空',
'configs.array' => '配置数据必须为数组格式'
];
protected $scene = [
'add' => ['contract_id', 'placeholder', 'table_name', 'field_name', 'field_type', 'is_required', 'default_value'],
'edit' => ['contract_id', 'placeholder', 'table_name', 'field_name', 'field_type', 'is_required', 'default_value'],
'batchConfig' => ['contract_id', 'configs']
];
}