We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e4efee commit 4cb757bCopy full SHA for 4cb757b
src/Rules/ValidIranPostalCode.php
@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+namespace Milwad\LaravelValidate\Rules;
4
5
+use Illuminate\Contracts\Validation\Rule;
6
7
+class ValidIranPostalCode implements Rule
8
+{
9
+ /**
10
+ * Check postal code is valid.
11
+ *
12
+ * @param string $attribute
13
+ * @param mixed $value
14
+ * @return bool
15
+ */
16
+ public function passes($attribute, $value)
17
+ {
18
+ return preg_match('/^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/', $value);
19
+ }
20
21
22
+ * Get the validation error message.
23
24
+ * @return string
25
26
+ public function message()
27
28
+ return __('validate.postal-code');
29
30
+}
0 commit comments