nurmanhabib/kewilayahan

API Data Wilayah Provinsi, Kota/Kab, Kecamatan, Kel/Desa di Indonesia dengan data dari BPS Tahun 2013.

1.2.0 2016-03-16 08:52 UTC

This package is auto-updated.

Last update: 2024-04-12 18:13:59 UTC


README

Install

  • Instalasi dengan Composer
     $ composer require nurmanhabib/kewilayahan
     
  • Tambahkan Nurmanhabib\Kewilayahan\KewilayahanServiceProvider::class pada config/app.php
     'providers' => [
         ...         
         Nurmanhabib\Kewilayahan\KewilayahanServiceProvider::class,
     ]
     
  • Copy file config.php ke config/kewilayahan.php
     $ php artisan vendor:publish --provider="Nurmanhabib\Kewilayahan\KewilayahanServiceProvider"
     
  • Create table dengan migration
     $ php artisan migrate
     
  • Insert data seeder kewilayahan
     $ php artisan db:seed --class="KewilayahanSeeder"
     

Penggunaan

$kewilayahan = app('kewilayahan');
$kewilayahan->setQuery($request->all());
$kewilayahan->setOutput('api');

$kewilayahan->setOutput(function ($data) use ($request) {
	$selected = ['selected' => 'tes'];

	return array_merge($data, [$selected]);
});

return $kewilayahan->load();

License

Apache