| 12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace App\Module\User\Validator;
- use App\Module\User\Models\UserPhone;
- use UCore\Validator;
- use function _\uniq;
- /**
- * 手机号码是否存在,不存在检查是否可用
- *
- */
- class PhoneAndCheck extends Validator
- {
- public function validate(mixed $value, array $data): bool
- {
- $userPhone = UserPhone::query()
- ->where('phone', '=', $value)
- ->first();
- if (!$userPhone) {
- return false;
- }
- return true;
- }
- }
|