File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ ## ValidCountry
2+
3+ If you want to validate the country name, you can use the ` ValidCountry ` rule:
4+
5+ ``` php
6+ use Milwad\LaravelValidate\Rules\ValidCountry;
7+
8+ return [
9+ 'country' => ['required', new ValidCountry()], // country => United Arab Emirates
10+ ];
11+ ```
12+
13+ Also, you can validate country name by key like "AE":
14+
15+ ``` php
16+ use Milwad\LaravelValidate\Rules\ValidCountry;
17+
18+ return [
19+ 'country' => ['required', new ValidCountry(validByKey: true)], // country => "AE"
20+ ];
21+ ```
22+
23+ For see the list of country name, you can open ` config/laravel-validate.php ` , and go to ` countries ` key:
24+
25+ ``` php
26+ /*
27+ * The list of country names.
28+ *
29+ * If any country name is missing from this list, you can add your country name to this array.
30+ */
31+ 'countries' => [...],
32+ ```
33+
34+ > If any country name is missing from this list, you can add your country name to this array.
You can’t perform that action at this time.
0 commit comments