diff --git a/lang/en/persian-validation.php b/lang/en/persian-validation.php index 361a28b..30ec555 100644 --- a/lang/en/persian-validation.php +++ b/lang/en/persian-validation.php @@ -13,7 +13,7 @@ 'ir_phone_code' => 'The :attribute must be a iranian phone area code number.', 'ir_phone_with_code' => 'The :attribute must be a iranian phone number with area code.', 'ir_postal_code' => 'The :attribute must be a iranian postal code.', - 'ir_card_number' => 'The :attribute must be a valid iranian payment card number.', + 'ir_bank_card_number' => 'The :attribute must be a valid iranian payment card number.', 'ir_sheba' => 'The :attribute must be a iranian sheba number.', 'ir_national_code' => 'The :attribute must be a iranian national code.', 'a_url' => 'The :attribute is an invalid url.', diff --git a/lang/fa/persian-validation.php b/lang/fa/persian-validation.php index fc927a1..9f1944e 100644 --- a/lang/fa/persian-validation.php +++ b/lang/fa/persian-validation.php @@ -16,7 +16,7 @@ 'ir_phone_code' => $incorrectMsg, 'ir_phone_with_code' => ':attribute باید بهمراه کد استان وارد شود.', 'ir_postal_code' => $invalidMsg, - 'ir_card_number' => $invalidMsg, + 'ir_bank_card_number' => $invalidMsg, 'ir_sheba' => $invalidMsg, 'ir_national_code' => $invalidMsg, 'a_url' => $incorrectMsg, diff --git a/src/PersianValidators.php b/src/PersianValidators.php index 4a50361..22ac276 100644 --- a/src/PersianValidators.php +++ b/src/PersianValidators.php @@ -273,10 +273,16 @@ public function validateIranianPostalCode($attribute, $value, $parameters) function validateIranianBankCardNumber($attribute, $value, $parameters) { if (isset($parameters[0]) && $parameters[0] == 'seprate') { + if (!preg_match('/^\d{4}-\d{4}-\d{4}-\d{4}$/', $value)) { + return false; + } $value = str_replace('-', '', $value); } if (isset($parameters[0]) && $parameters[0] == 'space') { + if (!preg_match('/^\d{4}\s\d{4}\s\d{4}\s\d{4}$/', $value)) { + return false; + } $value = str_replace(' ', '', $value); }