Skip to content

Commit 544f96f

Browse files
authored
Merge pull request #30
fix: check national id length before checking its characters
2 parents 237ff13 + a87957d commit 544f96f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Rules/IranianNationalId.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public function validate(string $attribute, mixed $value, Closure $fail): void
7373
*/
7474
protected function isValidNationalCode(string $value): bool
7575
{
76+
if (mb_strlen($value) !== 10) {
77+
return false;
78+
}
79+
7680
$sum = 0;
7781
$values = str_split($value);
7882

0 commit comments

Comments
 (0)