PHP code example of edi-prasetyo / indonesia-location

1. Go to this page and download the library: Download edi-prasetyo/indonesia-location 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/ */

    

edi-prasetyo / indonesia-location example snippets


use EdiPrasetyo\IndonesiaLocation\Models\Province;

$provinces = Province::all();

$provinces = Province::with('regencies.districts.villages')->get();

$aceh = Province::where('code', '11')->first();

$kabupaten = $aceh->regencies;
bash
php artisan indonesia-location:install
bash
php artisan indonesia-location:install --fresh
bash
php artisan indonesia-location:install --only=villages --fresh