diff --git a/README.md b/README.md index a8f7522..5b7cd16 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ return [ | 39 | [ValidUuid](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-uuid.md) | Validate uuid for ex (123e4567-e89b-12d3-a456-426655440000) | | 40 | [ValidVatId](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-vatid.md) | Validate european VAT ID ex (EL123456789123) | | 41 | [ValidLandlineNumber](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-landline-number.md) | Validate landline number | +| 42 | [ValidIranPlate](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-iran-plate.md) | Validate Iran car license plate | diff --git a/docs/1.x/valid-iran-plate.md b/docs/1.x/valid-iran-plate.md new file mode 100644 index 0000000..0e01eb8 --- /dev/null +++ b/docs/1.x/valid-iran-plate.md @@ -0,0 +1,15 @@ +## ValidIranPlate + +If you want to validate the Iran license plate number, you can use the `ValidIranPlate` rule: + +```php +use Milwad\LaravelValidate\Rules\ValidIranPlate; + +return [ + 'car-plate-number' => ['required', new ValidCarNumber()], + /* + * Iran plate license number: + * 32 ی 321 ایران 45 + */ +]; +``` diff --git a/src/Rules/ValidIranPlate.php b/src/Rules/ValidIranPlate.php new file mode 100644 index 0000000..fc5b16f --- /dev/null +++ b/src/Rules/ValidIranPlate.php @@ -0,0 +1,24 @@ + ':attribute non è valido.', 'username' => ':attribute non è valido.', 'uuid' => ':attribute non è valido.', + 'landline-number' => ':attribute non è valido.', + 'iran-plate' => ':attribute non è valido.', ]; diff --git a/src/lang/ar/validate.php b/src/lang/ar/validate.php index cc14c54..2620938 100644 --- a/src/lang/ar/validate.php +++ b/src/lang/ar/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute غير صالح.', 'username' => ':attribute غير صالح.', 'uuid' => ':attribute غير صالح.', + 'landline-number' => ':attribute غير صالح.', + 'iran-plate' => ':attribute غير صالح.', ]; diff --git a/src/lang/az/validate.php b/src/lang/az/validate.php index 10e9f73..c1c9e19 100644 --- a/src/lang/az/validate.php +++ b/src/lang/az/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute doğru deyil.', 'username' => ':attribute doğru deyil.', 'uuid' => ':attribute doğru deyil.', + 'landline-number' => ':attribute doğru deyil.', + 'iran-plate' => ':attribute doğru deyil.', ]; diff --git a/src/lang/bn/validate.php b/src/lang/bn/validate.php index b198a3e..9542289 100644 --- a/src/lang/bn/validate.php +++ b/src/lang/bn/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute বৈধ নয়.', 'username' => ':attribute বৈধ নয়.', 'uuid' => ':attribute বৈধ নয়.', + 'landline-number' => ':attribute বৈধ নয়.', + 'iran-plate' => ':attribute বৈধ নয়.', ]; diff --git a/src/lang/ca/validate.php b/src/lang/ca/validate.php index 95f7969..e701bbd 100644 --- a/src/lang/ca/validate.php +++ b/src/lang/ca/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute no és vàlid.', 'username' => ':attribute no és vàlid.', 'uuid' => ':attribute no és vàlid.', + 'landline-number' => ':attribute no és vàlid.', + 'iran-plate' => ':attribute no és vàlid.', ]; diff --git a/src/lang/de/validate.php b/src/lang/de/validate.php index ec52cee..1c43b93 100644 --- a/src/lang/de/validate.php +++ b/src/lang/de/validate.php @@ -41,4 +41,5 @@ 'username' => ':attribute kein gültiger.', 'uuid' => ':attribute kein gültiger.', 'landline-number' => ':attribute kein gültiger.', + 'iran-plate' => ':attribute kein gültiger.', ]; diff --git a/src/lang/el/validate.php b/src/lang/el/validate.php index 0c59ac0..b738219 100644 --- a/src/lang/el/validate.php +++ b/src/lang/el/validate.php @@ -40,4 +40,6 @@ 'url' => 'Το :attribute δεν είναι έγκυρο.', 'username' => 'Το :attribute δεν είναι έγκυρο.', 'uuid' => 'Το :attribute δεν είναι έγκυρο.', + 'landline-number' => 'Το :attribute δεν είναι έγκυρο.', + 'iran-plate' => 'Το :attribute δεν είναι έγκυρο.', ]; diff --git a/src/lang/en/validate.php b/src/lang/en/validate.php index 907315c..d20e961 100644 --- a/src/lang/en/validate.php +++ b/src/lang/en/validate.php @@ -40,4 +40,6 @@ 'url' => 'The :attribute is not valid.', 'username' => 'The :attribute is not valid.', 'uuid' => 'The :attribute is not valid.', + 'landline-number' => 'The :attribute is not valid.', + 'iran-plate' => 'The :attribute is not valid.', ]; diff --git a/src/lang/es/validate.php b/src/lang/es/validate.php index 923f4a3..6d5c66f 100644 --- a/src/lang/es/validate.php +++ b/src/lang/es/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute no es válido.', 'username' => ':attribute no es válido.', 'uuid' => ':attribute no es válido.', + 'landline-number' => ':attribute no es válido.', + 'iran-plate' => ':attribute no es válido.', ]; diff --git a/src/lang/fa/validate.php b/src/lang/fa/validate.php index c3f1810..f6b840c 100644 --- a/src/lang/fa/validate.php +++ b/src/lang/fa/validate.php @@ -41,4 +41,5 @@ 'username' => 'مقدار :attribute صحیح نمی باشد.', 'uuid' => 'مقدار :attribute صحیح نمی باشد.', 'landline-number' => 'مقدار :attribute صحیح نمی باشد.', + 'iran-plate' => 'مقدار :attribute صحیح نمی باشد.', ]; diff --git a/src/lang/fr/validate.php b/src/lang/fr/validate.php index b34fc3d..83ab93f 100644 --- a/src/lang/fr/validate.php +++ b/src/lang/fr/validate.php @@ -40,4 +40,6 @@ 'url' => ":attribute n'est pas valide.", 'username' => ":attribute n'est pas valide.", 'uuid' => ":attribute n'est pas valide.", + 'landline-number' => ":attribute n'est pas valide.", + 'iran-plate' => ":attribute n'est pas valide.", ]; diff --git a/src/lang/hi/validate.php b/src/lang/hi/validate.php index a0c6577..3905edd 100644 --- a/src/lang/hi/validate.php +++ b/src/lang/hi/validate.php @@ -40,4 +40,6 @@ 'url' => ':attributeमान्य नहीं है।.', 'username' => ':attributeमान्य नहीं है।.', 'uuid' => ':attributeमान्य नहीं है।.', + 'landline-number' => ':attributeमान्य नहीं है।.', + 'iran-plate' => ':attributeमान्य नहीं है।.', ]; diff --git a/src/lang/id/validate.php b/src/lang/id/validate.php index e53db54..8597f5b 100644 --- a/src/lang/id/validate.php +++ b/src/lang/id/validate.php @@ -40,4 +40,6 @@ 'url' => ':Attribute tidak valid.', 'username' => ':Attribute tidak valid.', 'uuid' => ':Attribute tidak valid.', + 'landline-number' => ':Attribute tidak valid.', + 'iran-plate' => ':Attribute tidak valid.', ]; diff --git a/src/lang/ja/validate.php b/src/lang/ja/validate.php index ef54429..279ecb7 100644 --- a/src/lang/ja/validate.php +++ b/src/lang/ja/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute有効じゃない。', 'username' => ':attribute有効じゃない。', 'uuid' => ':attribute有効じゃない。', + 'landline-number' => ':attribute有効じゃない。', + 'iran-plate' => ':attribute有効じゃない。', ]; diff --git a/src/lang/ko/validate.php b/src/lang/ko/validate.php index 929d8ee..cf49764 100644 --- a/src/lang/ko/validate.php +++ b/src/lang/ko/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute유효하지 않습니다.', 'username' => ':attribute유효하지 않습니다.', 'uuid' => ':attribute유효하지 않습니다.', + 'landline-number' => ':attribute유효하지 않습니다.', + 'iran-plate' => ':attribute유효하지 않습니다.', ]; diff --git a/src/lang/ku_so/validate.php b/src/lang/ku_so/validate.php index cddf0a7..f3b1f0a 100644 --- a/src/lang/ku_so/validate.php +++ b/src/lang/ku_so/validate.php @@ -40,4 +40,6 @@ 'url' => 'ئەو :attribute هەڵبژێردراوە نادروستە.', 'username' => 'ئەو :attribute هەڵبژێردراوە نادروستە.', 'uuid' => 'ئەو :attribute هەڵبژێردراوە نادروستە.', + 'landline-number' => 'ئەو :attribute هەڵبژێردراوە نادروستە.', + 'iran-plate' => 'ئەو :attribute هەڵبژێردراوە نادروستە.', ]; diff --git a/src/lang/mk/validate.php b/src/lang/mk/validate.php index fd9e2b2..bff3926 100644 --- a/src/lang/mk/validate.php +++ b/src/lang/mk/validate.php @@ -40,4 +40,6 @@ 'url' => 'Невалидна вредност :attribute', 'username' => 'Невалидна вредност :attribute', 'uuid' => 'Невалидна вредност :attribute', + 'landline-number' => 'Невалидна вредност :attribute', + 'iran-plate' => 'Невалидна вредност :attribute', ]; diff --git a/src/lang/nl/validate.php b/src/lang/nl/validate.php index 85bdd8a..1d57a88 100644 --- a/src/lang/nl/validate.php +++ b/src/lang/nl/validate.php @@ -40,4 +40,6 @@ 'url' => 'De :attribute is niet geldig.', 'username' => 'De :attribute is niet geldig.', 'uuid' => 'De :attribute is niet geldig.', + 'landline-number' => 'De :attribute is niet geldig.', + 'iran-plate' => 'De :attribute is niet geldig.', ]; diff --git a/src/lang/pt_BR/validate.php b/src/lang/pt_BR/validate.php index b2debbb..bec498e 100644 --- a/src/lang/pt_BR/validate.php +++ b/src/lang/pt_BR/validate.php @@ -40,4 +40,6 @@ 'url' => 'O :attribute não é válido.', 'username' => 'O :attribute não é válido.', 'uuid' => 'O :attribute não é válido.', + 'landline-number' => 'O :attribute não é válido.', + 'iran-plate' => 'O :attribute não é válido.', ]; diff --git a/src/lang/ru/validate.php b/src/lang/ru/validate.php index befcc69..ede5f97 100644 --- a/src/lang/ru/validate.php +++ b/src/lang/ru/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute не действует.', 'username' => ':attribute не действует.', 'uuid' => ':attribute не действует.', + 'landline-number' => ':attribute не действует.', + 'iran-plate' => ':attribute не действует.', ]; diff --git a/src/lang/si/validate.php b/src/lang/si/validate.php index 2198a55..9995433 100644 --- a/src/lang/si/validate.php +++ b/src/lang/si/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute වලංගු නොවේ.', 'username' => ':attribute වලංගු නොවේ.', 'uuid' => ':attribute වලංගු නොවේ.', + 'landline-number' => ':attribute වලංගු නොවේ.', + 'iran-plate' => ':attribute වලංගු නොවේ.', ]; diff --git a/src/lang/sv/validate.php b/src/lang/sv/validate.php index 9e8310f..ce61dc0 100644 --- a/src/lang/sv/validate.php +++ b/src/lang/sv/validate.php @@ -40,4 +40,6 @@ 'url' => 'Värdet :attribute är inte korrekt.', 'username' => 'Värdet :attribute är inte korrekt.', 'uuid' => 'Värdet :attribute är inte korrekt.', + 'landline-number' => 'Värdet :attribute är inte korrekt.', + 'iran-plate' => 'Värdet :attribute är inte korrekt.', ]; diff --git a/src/lang/tr/validate.php b/src/lang/tr/validate.php index 7b40e7f..75ec2d8 100644 --- a/src/lang/tr/validate.php +++ b/src/lang/tr/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute doğru değil.', 'username' => ':attribute doğru değil.', 'uuid' => ':attribute doğru değil.', + 'landline-number' => ':attribute doğru değil.', + 'iran-plate' => ':attribute doğru değil.', ]; diff --git a/src/lang/uk/validate.php b/src/lang/uk/validate.php index aafb4c5..c8f61ee 100644 --- a/src/lang/uk/validate.php +++ b/src/lang/uk/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute не є дійсним.', 'username' => ':attribute не є дійсним.', 'uuid' => ':attribute не є дійсним.', + 'landline-number' => ':attribute не є дійсним.', + 'iran-plate' => ':attribute не є дійсним.', ]; diff --git a/src/lang/zh_CN/validate.php b/src/lang/zh_CN/validate.php index 6768cd8..f6cd6b5 100644 --- a/src/lang/zh_CN/validate.php +++ b/src/lang/zh_CN/validate.php @@ -40,4 +40,6 @@ 'url' => ':attribute无效.', 'username' => ':attribute无效.', 'uuid' => ':attribute无效.', + 'landline-number' => ':attribute无效.', + 'iran-plate' => ':attribute无效.', ]; diff --git a/tests/Rules/ValidIranPlateTest.php b/tests/Rules/ValidIranPlateTest.php new file mode 100644 index 0000000..a1b8d74 --- /dev/null +++ b/tests/Rules/ValidIranPlateTest.php @@ -0,0 +1,33 @@ + [new ValidIranPlate]]; + $data = ['car_number' => '32 ی 321 ایران 45']; + $passes = $this->app['validator']->make($data, $rules)->passes(); + + $this->assertTrue($passes); + } + + /** + * Test iran license plate is not valid. + */ + public function test_iran_plate_is_not_valid() + { + $rules = ['car_number' => [new ValidIranPlate]]; + $data = ['car_number' => '32 ی 321 ترکیه 45']; + $passes = $this->app['validator']->make($data, $rules)->passes(); + + $this->assertFalse($passes); + } +}