PHP code example of didiwijaya / wilindo

1. Go to this page and download the library: Download didiwijaya/wilindo 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/ */

    

didiwijaya / wilindo example snippets


use DidiWijaya\WilIndo\Models\Province;
use DidiWijaya\WilIndo\Models\City;
use DidiWijaya\WilIndo\Models\District;
use DidiWijaya\WilIndo\Models\Village;

// Ambil semua provinsi
$provinces = Province::all();

// Ambil kota berdasarkan provinsi
$cities = City::byProvince('32')->get();

// Ambil kecamatan berdasarkan kota
$districts = District::byCity('3201')->get();

// Ambil desa berdasarkan kecamatan
$villages = Village::byDistrict('3201010')->get();

// Ambil data lengkap dengan relationship
$village = Village::with(['district.city.province'])->find(1);

use DidiWijaya\WilIndo\Helpers\WilindoHelper;

// Ambil semua provinsi
$provinces = WilindoHelper::getProvinces();

// Ambil kota berdasarkan provinsi
$cities = WilindoHelper::getCitiesByProvince('32');

// Ambil alamat lengkap berdasarkan kode desa
$address = WilindoHelper::getCompleteAddress('3201010001');

// Cari provinsi berdasarkan nama
$provinces = WilindoHelper::searchProvinces('Jawa');

// Ambil statistik data
$stats = WilindoHelper::getStatistics();

return [
    'prefix' => 'wilindo_', // Prefix untuk nama tabel
];
bash
php artisan wilindo:publish
bash
php artisan migrate
bash
php artisan db:seed --class=WilindoSeeder
bash
php artisan wilindo:publish
bash
php artisan vendor:publish --tag=wilindo-config
bash
php artisan vendor:publish --tag=wilindo-migrations
bash
php artisan vendor:publish --tag=wilindo-seeders