46 lines
814 B
PHP
46 lines
814 B
PHP
<?php
|
|
|
|
namespace app\admin\validate;
|
|
|
|
use think\Validate;
|
|
|
|
class Student extends Validate
|
|
{
|
|
/**
|
|
* 验证规则
|
|
*/
|
|
protected $rule = [
|
|
'identifier' => 'unique:student,identifier',
|
|
'mobile' => 'regex:1[3-9]\d{9}|unique:student,mobile'
|
|
];
|
|
|
|
/**
|
|
* 字段描述
|
|
*/
|
|
protected $field = [
|
|
];
|
|
|
|
/**
|
|
* 提示消息
|
|
*/
|
|
protected $message = [
|
|
];
|
|
/**
|
|
* 验证场景
|
|
*/
|
|
protected $scene = [
|
|
'add' => [],
|
|
'edit' => [],
|
|
];
|
|
|
|
public function __construct(array $rules = [], $message = [], $field = [])
|
|
{
|
|
$this->field = [
|
|
'identifier' => __('Identifier'),
|
|
'mobile' => __('Mobile'),
|
|
];
|
|
parent::__construct($rules, $message, $field);
|
|
}
|
|
|
|
}
|