Closed masoudmanson closed 7 years ago
If it's a newly-recognised country, check that it's not available in the latest release, as I've just refreshed the data.
Otherwise, the package returns a collection so you can "put" additional items into the collection. For example: Countries::lookup()->put('ZZ', 'My Country')->sort();
Hum, good idea, thank you :D I'll try it. No, it's not a new country. I am fetching country list from a third party WS and they define Kosovo with "KV" but the correct code is "XK". BTW, thank you again for your help 👍
Interesting example. I often have the same problem with data sets that use 'UK' rather than 'GB'. Here's how you can switch out a single key:
Countries::lookup()->mapWithKeys(function($country, $key) {
return $key == 'XK' ? [ 'KV' => $country ] : [ $key => $country ];
});
How can I add a new country code to the list? Editing vendor files isn't good :| Any Ideas?