123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\api\validate;
- use think\Validate;
- class Card extends Validate
- {
- // 验证规则
- protected $rule = [
- 'company_name' => 'require|chsDash|max:30',
- 'department' => 'require|chsDash|max:20',
- 'name' => 'require|chsAlphaNum|max:10',
- 'position' => 'chsDash|max:20',
- 'phone' => 'mobile',
- 'wx' => 'max:20',
- 'email' => 'email',
- 'brief' => 'max:255',
- ];
- // 验证消息
- protected $message = [
- 'company_name.require' => '请填写公司名称',
- 'company_name.chsDash' => '公司名称格式错误',
- 'company_name.max' => '公司名称20字以内',
- 'department.require' => '请填写部门',
- 'department.chsDash' => '部门格式错误',
- 'department.max' => '部门限制20字以内',
- 'name.require' => '请填写姓名',
- 'name.chsDash' => '姓名格式错误',
- 'name.max' => '姓名限制10字以内',
- 'position.chsDash' => '职务格式错误',
- 'position.max' => '职务限制20字以内',
- 'phone.mobile' => '手机号格式错误',
- 'wx.max' => '微信号超出长度',
- 'email.email' => '邮箱格式错误',
- 'brief.max' => '个人简介超出长度',
- ];
- // 验证场景
- protected $scene = [
- 'save' => ['company_name', 'department', 'name', 'position', 'phone', 'wx', 'email', 'brief'],
- ];
- }
|