fmendoza / laravel-mx-db by fmendoza

Mxdb is a package for Laravel 4, providing the states and cities of Mexico.
63
2
2
Package Data
Maintainer Username: fmendoza
Maintainer Contact: fernando@ggamma.com (Fernando Mendoza)
Package Create Date: 2015-02-23
Package Last Update: 2015-02-24
Language: PHP
License: Unknown
Last Refreshed: 2024-11-19 03:02:15
Package Statistics
Total Downloads: 63
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel Mxdb

Mxdb is a package for Laravel 4, providing the states and cities of Mexico.

Installation

Add fmendoza/mxdb to composer.json.

"fmendoza/mxdb": "dev-master"

Run composer update to pull down the latest version.

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

'providers' => array(
    'Fmendoza\Mxdb\MxdbServiceProvider',
)

Now add the alias.

'aliases' => array(
    'State' => 'Fmendoza\Mxdb\StateFacade',
    'City' => 'Fmendoza\Mxdb\CityFacade',
)

Model

This is an optional step, it contains the tables name and does not need to be altered. If the default name states and cities suits you, leave it. Otherwise run the following command

$ php artisan config:publish fmendoza/mxdb

Next generate the migration file:

$ php artisan mxdb:migration

It will generate the <timestamp>_setup_states_table.php and <timestamp>_setup_cities_table.php migrations and the MexicoSeeder.php seeder. To make sure the data is seeded insert the following code in the seeds/DatabaseSeeder.php

$this->call('MexicoSeeder');
$this->command->info('Seeded the states and cities!'); 

You may now run it with the artisan migrate command:

$ php artisan migrate --seed

After running this command the filled states and cities tables will be available