abdelrahman2018/world-countries-cities2

There is no license information available for the latest version (v0.1.2) of this package.

v0.1.2 2015-09-18 21:25 UTC

This package is not auto-updated.

Last update: 2024-04-17 18:37:24 UTC


README

A Laravel package for using world's popular countries and cities.

Features

  • Add the countries/cities to the database using migration and seeders.
  • Use the countries/cities directly from the package without using the database.

Installation

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

Usage

Migration

After running php artisan vendor:publish you can directly run:

php artisan migrate

Seeders

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.

Direct usage

To be implementated.

Credits

The data is based on MySQL's world database example.