yayann / laravel-countries by yayann
forked from webpatser/laravel-countries

Laravel Countries is a bundle for Laravel, providing Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries.
623
1
1
Package Data
Maintainer Username: yayann
Maintainer Contact: christoph@downsized.nl (Christoph Kempen)
Package Create Date: 2014-09-02
Package Last Update: 2015-01-27
Language: PHP
License: MIT
Last Refreshed: 2024-04-14 15:05:29
Package Statistics
Total Downloads: 623
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Laravel Countries

Total Downloads Latest Stable Version Latest Unstable Version

Laravel Countries is a bundle for Laravel, providing Almost ISO 3166_2, 3166_3, currency, Capital and more for all countries.

Installation

Add webpatser/laravel-countries to composer.json.

"webpatser/laravel-countries": "dev-master"

Run composer update to pull down the latest version of Country List.

Edit app/config/app.php and add the provider and filter

'providers' => array(
    'Webpatser\Countries\CountriesServiceProvider',
)

Now add the alias.

'aliases' => array(
    'Countries' => 'Webpatser\Countries\CountriesFacade',
)

Model

You can start by publishing the configuration. This is an optional step, it contains the table name and does not need to be altered. If the default name countries suits you, leave it. Otherwise run the following command

$ php artisan config:publish webpatser/laravel-countries

Next generate the migration file:

$ php artisan countries:migration

It will generate the <timestamp>_setup_countries_table.php migration and the CountriesSeeder.php seeder. To make sure the data is seeded insert the following code in the seeds/DatabaseSeeder.php

//Seed the countries
$this->call('CountriesSeeder');
$this->command->info('Seeded the countries!'); 

You may now run it with the artisan migrate command:

$ php artisan migrate --seed

After running this command the filled countries table will be available