tienrocker/thailand-provinces

Thailand provinces database as Laravel package

Installs: 34

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:laravel-package

v0.1.2 2018-09-16 12:27 UTC

This package is auto-updated.

Last update: 2024-04-17 01:38:31 UTC


README

Thailand provinces data for Laravel

Latest Stable Version Total Downloads Latest Unstable Version License

Thailand provinces database

This database was taken from https://github.com/parsilver/thailand-provinces-php.

Installation

Add tienrocker/thailand-provinces to composer.json.

"tienrocker/thailand-countries": "dev-master"

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

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

'providers' => [
    'Tienrocker\ThProvinces\ProvincesServiceProvider',
]

Now add the alias.

'aliases' => [
    'ThProvinces' => 'Tienrocker\ThProvinces\Provinces\Facades\Provinces',
]

Model (Data)

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 provinces suits you, leave it. Otherwise run the following command

$ php artisan vendor:publish --tag=thprovinces

Next generate the migration file:

$ php artisan thprovinces:migration

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

//Seed the provinces
$this->call('ProvincesSeeder');
$this->command->info('Seeded Thailand provinces!'); 

You can also run php artisan db:seed --class=ProvincesSeeder instead of adding those commands in seeds/DatabaseSeeder.php

You may now run it with the artisan migrate command:

$ php artisan migrate --seed

After running this command the filled provinces table will be available for usage in your application.