Skip to content

Commit 4bb5403

Browse files
committed
fix recently sent string
1 parent 654f5b1 commit 4bb5403

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lang/en/strings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'exists' => 'The :attribute has already been taken.',
1010
'doesnt-exist' => 'The :attribute does not exist.',
1111
'locked' => 'The number is locked due to too many attempts.',
12-
'recently_sent' => 'The code was recently sent to this number.'
12+
'recently_sent' => 'The code was recently sent to this number. You can try again in :time.'
1313
],
1414
'country_code' => [
1515
'invalid' => 'The country code is invalid.'

src/Rules/IsValidMobileNumber.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ public function validate(string $attribute, mixed $value, Closure $fail): void
112112
$fail(trans('mobile-verification::strings.validation.number.locked'));
113113
}
114114

115-
if ($mobile_number->was_sent_recently) { // todo: test
116-
$fail(trans('mobile-verification::strings.validation.number.recently_sent'));
115+
if ($mobile_number->was_sent_recently) {
116+
$resend_verification_code_in_seconds = $mobile_number->resend_verification_code_in ?? 0;
117+
118+
$fail(trans('mobile-verification::strings.validation.number.recently_sent', ['time' => seconds_to_human_readable($resend_verification_code_in_seconds)]));
117119
}
118120
}
119121
}

0 commit comments

Comments
 (0)