Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
|
- <?php
-
- namespace App\Rules;
-
- use App\Util\KeysConverter;
-
- class ParkingManagementCode extends BaseRule
- {
-
- private string $customerCode;
- /**
- * Create a new rule instance.
- *
- * @return void
- */
- public function __construct($customerCode = "")
- {
- $this->customerCode = $customerCode;
- }
-
-
- public function check($value) : bool
- {
- if (!is_string($value)) return false;
- if (strlen($value) !== 5) return false;
-
- if(strlen($this->customerCode)){
- try {
- KeysConverter::getTblPark($this->customerCode, $value);
- }catch(Exception){
- return false;
- }
- }
- return true;
- }
-
- /**
- * Get the validation error message.
- *
- * @return string
- */
- public function message()
- {
- return '正しくありません';
- }
- }
|