UidValidator.php 377 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Module\User\Validator;
  3. use UCore\Validator;
  4. use App\Models\Hp\User;
  5. /**
  6. * 判断uid是否存在,存在true
  7. */
  8. class UidValidator extends Validator
  9. {
  10. public function validate(mixed $value, array $data): bool
  11. {
  12. $user = User::query()->find($value);
  13. if ($user) {
  14. return true;
  15. }
  16. return false;
  17. }
  18. }