File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -2318,17 +2318,12 @@ public function isValid()
2318
2318
$ this ->isValidEmail ();
2319
2319
}
2320
2320
2321
- if ($ this ->isDirty ('country_acronym ' )) {
2322
- if (present ($ this ->country_acronym )) {
2323
- $ country = app ('countries ' )->byCode ($ this ->country_acronym );
2324
- if ($ country === null ) {
2325
- $ this ->validationErrors ()->add ('country ' , '.invalid_country ' );
2326
- } else {
2327
- // ensure matching case
2328
- $ this ->country_acronym = $ country ->getKey ();
2329
- }
2330
- } else {
2331
- $ this ->country_acronym = Country::UNKNOWN ;
2321
+ $ countryAcronym = $ this ->country_acronym ;
2322
+ if ($ countryAcronym === null ) {
2323
+ $ this ->country_acronym = Country::UNKNOWN ;
2324
+ } elseif ($ this ->isDirty ('country_acronym ' ) && $ countryAcronym !== Country::UNKNOWN ) {
2325
+ if (app ('countries ' )->byCode ($ countryAcronym ) === null ) {
2326
+ $ this ->validationErrors ()->add ('country ' , '.invalid_country ' );
2332
2327
}
2333
2328
}
2334
2329
You can’t perform that action at this time.
0 commit comments