2017 © Pedro Peláez
 

library laraciproid

Indonesia city and province data migration and seeder for Laravel.

image

matriphe/laraciproid

Indonesia city and province data migration and seeder for Laravel.

  • Sunday, December 31, 2017
  • by matriphe
  • Repository
  • 1 Watchers
  • 21 Stars
  • 1,808 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

Laraciproid

Laravel City Province ID

Indonesia city and province data migration and seeder for Laravel 5.x., (*1)

Installation

Using composer, run this command from your Laravel's project root directory:, (*2)

composer require matriphe/laraciproid:~1.0

Configuration

Laravel 5.5

Nothing to do. Laraciproid will be loaded automatically., (*3)

Laravel 5.1, 5.2, 5.3, and 5.4

Open config/app.php and add this line on autoloaded service providers section., (*4)

'providers' => [
    ...
    Matriphe\Laraciproid\ServiceProvider::class,
    ...
],

Laravel 5.0

Open config/app.php and add this line on autoloaded service providers section., (*5)

'providers' => [
        ...
        'Matriphe\Laraciproid\ServiceProvider',
        ...
],

Publish Vendor

php artisan vendor:publish

Or if you want to more specific, and want to force the vendor publishing., (*6)

php artisan vendor:publish --provider="Matriphe\Laraciproid\ServiceProvider" --force

This command will add these files to your project:, (*7)

  • config/laraciproid.php, the configuration file containing tables name.
  • database/migrations/2015_09_28_175100_create_city_province_tables, the migration file.
  • database/sql/city.sql, SQL file for city seed.
  • database/sql/province.sql, SQL file for province seed.
  • database/json/cities.json, JSON file for cities seed.
  • database/json/provinces.json, JSON file for provinces seed.
  • database/seeds/LaraciproidSeeder.php, table seeder file, read the SQL data.
  • app/Models/City.php, city model file.
  • app/Models/Province.php, province model file.

Run Migration

php artisan migrate

Run Database Seeder

php artisan db:seed --class=LaraciproidSeeder

You can add this file to your database/seeds/DatabaseSeeder.php to make it auto loaded on seeding command., (*8)

public function run()
{
    Model::unguard();

    $this->call('LaraciproidSeeder');
}

Relationship

Province table has one to many relationship of City table., (*9)

// Get all cities under DI Yogyakarta (province_id = 34)
$cities = App\Models\Province::find(34)->cities;

foreach ($cities as $city) {
    // Do something
}

// Get province name of Bogor (city_id = 3271)
$city = App\Models\City::find(3271);
$province_name = $city->province->province_name;

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

31/12 2017

dev-master

9999999-dev

Indonesia city and province data migration and seeder for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel data id city seeder indonesia province ina

07/09 2017

1.4

1.4.0.0

Indonesia city and province data migration and seeder for Laravel.

  Sources   Download

MIT

The Requires

 

laravel data id city seeder indonesia province ina

05/08 2017

1.3

1.3.0.0

Indonesia city and province data migration and seeder for Laravel.

  Sources   Download

MIT

The Requires

 

laravel data id city seeder indonesia province ina

21/05 2016

1.2

1.2.0.0

Indonesia city and province data migration and seeder for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel data id city seeder indonesia province ina

04/10 2015

1.1

1.1.0.0

Indonesia city and province data migration and seeder for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel data id city seeder indonesia province ina

28/09 2015

1.0

1.0.0.0

Indonesia city and province data migration and seeder for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel data id city seeder indonesia province ina