nnjeim / world

A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.
MIT License
761 stars 104 forks source link

Add ability to load only some countries based on config loadedCountries #26

Closed aeq-dev closed 2 years ago

aeq-dev commented 2 years ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Sometimes we may need only some countries for our application, so no need to insert the whole World DB, and later we may append other countries

nnjeim commented 2 years ago

hi @aeq-dev thank you for your contribution. if you don't mind consider adding in config an additional key: restrict_countries = false by default in order not to change the behaviour for the rest of the users. in this case your condition in the seeder would be changed to include the restrict_countries too and the restriction array. Please let me know what do you think of this?

aeq-dev commented 2 years ago

Hi @nnjeim Thanks for your consideration. I think the 'loadedCountries' key is enough, just mention in comment to leave the array empty if you'd like to migrate all countries, of course the default value of this key is empty []. Also we should mention in comment to set iso2 keys for countries to be loaded

nnjeim commented 2 years ago

Hi again, in this case let's keep this array empty in order not to limit the usage for other users. what do you think if we elaborate here by having: allowed_countries and disallowed_countries arrays (like white and black listing) these 2 arrays could be left empty by default.

aeq-dev commented 2 years ago

Yes good idea, Done.

nnjeim commented 2 years ago

Yes good idea, Done.

Thanks a lot. Great addition.