All Projects → matriphe → Laraciproid

matriphe / Laraciproid

Indonesia city and province data migration and seeder for Laravel.

Projects that are alternatives of or similar to Laraciproid

Laravel World
provide countries, states, and cities relations and database.
Stars: ✭ 222 (+825%)
Mutual labels:  laravel, city
Tr Geozones
Ülkeler ve Türkiye İl İlçe Semt Mahalle ve Posta Kodu Veritabanı (Laravel)
Stars: ✭ 46 (+91.67%)
Mutual labels:  laravel, city
React Laravel
Package for using ReactJS with Laravel
Stars: ✭ 907 (+3679.17%)
Mutual labels:  laravel
Laravel Tools
路飞laravel工具
Stars: ✭ 24 (+0%)
Mutual labels:  laravel
Laravel Sri
Subresource Integrity hash generator for laravel
Stars: ✭ 23 (-4.17%)
Mutual labels:  laravel
Vscode Laravel Extra Intellisense
This extension adds extra autocompletion for laravel projects to VSCode.
Stars: ✭ 909 (+3687.5%)
Mutual labels:  laravel
Pagarme Laravel
Pagar.me SDK for Laravel applications.
Stars: ✭ 23 (-4.17%)
Mutual labels:  laravel
Simple Cache
An easy to use Caching trait for Laravel's Eloquent Models.
Stars: ✭ 19 (-20.83%)
Mutual labels:  laravel
Sentry Laravel
Laravel SDK for Sentry
Stars: ✭ 927 (+3762.5%)
Mutual labels:  laravel
Vms
VMS is your Video Subscription Platform. Add unlimited videos, posts, and pages to your subscription site. Earn re-curring revenue and require users to subscribe to access premium content on your website.
Stars: ✭ 23 (-4.17%)
Mutual labels:  laravel
Eloquent Filter
This simple package helps you filter Eloquent data using query filters.
Stars: ✭ 24 (+0%)
Mutual labels:  laravel
Laravel Scout Tntsearch Driver
Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch
Stars: ✭ 917 (+3720.83%)
Mutual labels:  laravel
Tenancy
Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups.
Stars: ✭ 916 (+3716.67%)
Mutual labels:  laravel
Beautymail
Send beautiful HTML emails with Laravel
Stars: ✭ 923 (+3745.83%)
Mutual labels:  laravel
Validating
Automatically validating Eloquent models for Laravel
Stars: ✭ 906 (+3675%)
Mutual labels:  laravel
Laravel Mqtt Publish
A laravel mqtt publisher
Stars: ✭ 24 (+0%)
Mutual labels:  laravel
Eloquent Ldap
A Laravel 5.1 package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.
Stars: ✭ 19 (-20.83%)
Mutual labels:  laravel
Eloquent Sortable
Sortable behaviour for Eloquent models
Stars: ✭ 914 (+3708.33%)
Mutual labels:  laravel
Jsonrpc
JsonRpc Server extension for Laravel/Lumen
Stars: ✭ 23 (-4.17%)
Mutual labels:  laravel
Barryvanveen
📰 Personal blog of Barry van Veen. Focuses on Laravel Framework, website optimization and natural computing.
Stars: ✭ 24 (+0%)
Mutual labels:  laravel

Laraciproid

Laravel City Province ID

Indonesia city and province data migration and seeder for Laravel 5.x.

Installation

Using composer, run this command from your Laravel's project root directory:

composer require matriphe/laraciproid:~1.0

Configuration

Laravel 5.5

Nothing to do. Laraciproid will be loaded automatically.

Laravel 5.1, 5.2, 5.3, and 5.4

Open config/app.php and add this line on autoloaded service providers section.

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

Laravel 5.0

Open config/app.php and add this line on autoloaded service providers section.

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

Publish Vendor

php artisan vendor:publish

Or if you want to more specific, and want to force the vendor publishing.

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

This command will add these files to your project:

  • 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.

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

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

Relationship

Province table has one to many relationship of City table.

// 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].