領収証発行サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
504B

  1. <?php
  2. namespace App\Rules;
  3. class ZipCode extends BaseRule
  4. {
  5. /**
  6. * Create a new rule instance.
  7. *
  8. * @return void
  9. */
  10. public function __construct()
  11. {
  12. //
  13. }
  14. public function check($value) : bool
  15. {
  16. return preg_match("/^\d{7}$/", $value) !== 0;
  17. }
  18. /**
  19. * Get the validation error message.
  20. *
  21. * @return string
  22. */
  23. public function message()
  24. {
  25. return '正しい郵便番号を入力してください';
  26. }
  27. }