PHP code example of sawirricardo / indonesia-region

1. Go to this page and download the library: Download sawirricardo/indonesia-region library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sawirricardo / indonesia-region example snippets


return [
    'model' => \Sawirricardo\IndonesiaRegion\Models\IndonesiaRegion::class,
];

$provinces = \Sawirricardo\IndonesiaRegion\Models\IndonesiaRegion::query()->provinces()->get();
$cities = \Sawirricardo\IndonesiaRegion\Models\IndonesiaRegion::query()->cities()->where('parent_id',1)->get();
$districts = \Sawirricardo\IndonesiaRegion\Models\IndonesiaRegion::query()->districts()->where('parent_id',1)->get();
bash
php artisan vendor:publish --tag="indonesia-region-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="indonesia-region-config"
bash
php artisan vendor:publish --tag="example-views"