Closed aeq-dev closed 2 years ago
You can set a parameter 'loadedCountries' in world config :
'loadedCountries' => ['US', 'FR'],
and in initCountries function, something like this:
private function initCountries(): void
{
app(Models\Country::class)->truncate();
$this->countries['data'] = json_decode(File::get(__DIR__ . '/../../resources/json/countries.json'), true);
if (!empty(config('world.loadedCountries')))
$this->countries['data'] = Arr::where($this->countries['data'], function ($value, $key) {
return in_array($value['iso2'], config('world.loadedCountries'));
});
```}
I've done a PR for this.
Please check :)
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
Thanks