| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Http\Validator;
- class AcceptorValidator extends BaseValidator
- {
- // 当前模型所有验证规则
- public static $rules = [
- 'id' => 'required',
- 'realname' => 'required|max:30',
- 'name' => 'required|max:30',
- 'pay_type' => 'required',
- 'usdt' => 'required',
- 'status' => 'required',
- ];
- public static $msgs = [
- 'required' => ':attribute不能为空',
- 'string' => ':attribute必须是字符串',
- 'min' => ':attribute长度不能小于:min位',
- 'max' => ':attribute长度不能大于:max位',
- 'exists' => ':attribute不存在',
- 'rule' => ':attribute格式不正确',
- 'mobile' => ':attribute格式不正确',
- ];
- // 当前模型所有验证字段
- public static $fields = [
- 'id' => 'ID',
- 'name' => '商户名称',
- 'realname' => '商户姓名',
- 'usdt' => '充值金额',
- 'type' => '商家类别',
- 'mobile' => '联系方式',
- 'pay_type' => '支付方式',
- 'status' => '状态',
- ];
- // 当前模型所有验证场景
- public static $scenes = [
- 'info'=> ['id'],
- 'modify'=> ['name','realname'],
- 'apply'=> ['name','realname','pay_type'],
- 'recharge'=> ['usdt'],
- ];
- /**
- * 验证
- * @param $request
- * @param string $scene
- * @return int|mixed
- */
- public static function check($request, $scene=''){
- $validator = new BaseValidator(self::$rules, self::$msgs, self::$fields, self::$scenes);
- return $validator->checkParams($request, $scene);
- }
- }
|