nurmanhabib/kewilayahan

使用来自BPS 2013年的数据的印度尼西亚省、市/县、区、村/居民点的API数据。

1.2.0 2016-03-16 08:52 UTC

This package is auto-updated.

Last update: 2024-09-12 18:59:11 UTC


README

安装

  • 使用Composer进行安装
     $ composer require nurmanhabib/kewilayahan
     
  • config/app.php中添加Nurmanhabib\Kewilayahan\KewilayahanServiceProvider::class
     'providers' => [
         ...         
         Nurmanhabib\Kewilayahan\KewilayahanServiceProvider::class,
     ]
     
  • 将文件config.php复制到config/kewilayahan.php
     $ php artisan vendor:publish --provider="Nurmanhabib\Kewilayahan\KewilayahanServiceProvider"
     
  • 使用迁移创建表
     $ php artisan migrate
     
  • 插入kewilayahan的数据seeder
     $ php artisan db:seed --class="KewilayahanSeeder"
     

使用方法

$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();

许可证

Apache