A Laravel package for using world's popular countries and cities.
- Add the countries/cities to the database using migration and seeders.
- Use the countries/cities directly from the package without using the database.
Require the package with composer:
composer require alakkad/world-countries-cities
Add the ServiceProvider to the providers array in config/app.php
'Alakkad\WorldCountriesCities\WorldCountriesCitiesServiceProvider',
Copy the package config and migrations files to your local directories with:
php artisan vendor:publish
After running php artisan vendor:publish
you can directly run:
php artisan migrate
In order to seed the migrated tables, you need to edit database/seeds/DatabaseSeeder.php
and add the following lines:
public function run()
{
Model::unguard();
$this->call('Alakkad\WorldCountriesCities\CitiesSeeder');
$this->call('Alakkad\WorldCountriesCities\CountriesSeeder');
}
Then run:
php artisan db:seed
Be careful, the seeders files truncate the tables before inserting, to prevent any duplication.
To be implementated.
The data is based on MySQL's world database example.