buchin/indodata

使用PHP的印度尼西亚省份-城市-区-县数据

dev-master 2016-12-04 06:20 UTC

This package is auto-updated.

Last update: 2024-09-15 18:15:30 UTC


README

与印度尼西亚相关的数据库有哪些。使用Eloquent模型支持多对多关系和属于关系。

使用Composer安装

composer require buchin/indodata

使用示例

use Buchin\Indodata\Province;
use Buchin\Indodata\City;
use Buchin\Indodata\District;
use Buchin\Indodata\Village;

// Initialize Capsule. Required to initialize DB connection.
$capsule = new Capsule;


// Relationship: Belongs To
// Get village
$village = Village::first();

// Get district
$district = $village->district;

// Get City
$city = $district->city;

// Get Province
$province = $city->province();

// Chainable
$province = $village->district->city->province;