PHPackages                             zhiephie/lushi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. zhiephie/lushi

ActiveLibrary[Database &amp; ORM](/categories/database)

zhiephie/lushi
==============

A library of static Eloquent models for data Administrative Subdivisions of Indonesia.

0.2(5y ago)33MITPHPPHP ^7.2

Since Oct 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/zhiephie/lushi)[ Packagist](https://packagist.org/packages/zhiephie/lushi)[ Docs](https://github.com/zhiephie/lushi)[ Fund](https://paypal.me/YudiPurwanto?locale.x=id_ID)[ RSS](/packages/zhiephie-lushi/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (3)Used By (0)

Laravel Lushi 📜
===============

[](#laravel-lushi-)

[![CI status](https://github.com/zhiephie/lushi/workflows/run-tests/badge.svg)](https://github.com/zhiephie/lushi/actions)

Lushi is a library of static Eloquent models for fixture data Administrative Subdivisions of Indonesia, such as provincies, regencies, districts and villages.

Contents
--------

[](#contents)

- [Installing Lushi](#installing-lushi)
- [Using a model](#using-a-model)
- [Available models](#available-models)
    - [`Lushi\Models\Province`](#lushimodelsprovince)
    - [`Lushi\Models\Regency`](#lushimodelsregency)
    - [`Lushi\Models\District`](#lushimodelsdistrict)
    - [`Lushi\Models\Village`](#lushimodelsvillage)
- [Model relationships](#model-relationships)
- [Column customisation](#column-customisation)
- [Contributing](#contributing)

Installing Lushi
----------------

[](#installing-lushi)

You can use Composer to install Lushi into your application.

```
composer require zhiephie/lushi

```

No additional setup is required.

Using a model
-------------

[](#using-a-model)

You can interact with a Lushi model just like you would any other Eloquent model, except that it only handles read-only operations.

```
use Lushi\Models\Country;

Province::all(); // Get information about all provinces.

Province::find(11); // Get information about the ID 11.

Province::where('name', 'like', '%JAWA%')->get(); // Get information about all provinces that contain the character "JAVA".
```

Available models
----------------

[](#available-models)

### `Lushi\Models\Province`

[](#lushimodelsprovince)

Column NameDescriptionExample`id`ID province.`11``name`Province name.`Jawa Timur`Relationship nameModel`regencies`[`Lushi\Models\Regency`](#lushimodelsregency)### `Lushi\Models\Regency`

[](#lushimodelsregency)

Column NameDescriptionExample`id`ID regency.`1101``province_id`ID province.`11``name`Regency name.`KOTA SABANG`Relationship nameModel`districts`[`Lushi\Models\District`](#lushimodelsdistrict)### `Lushi\Models\District`

[](#lushimodelsdistrict)

Column NameDescriptionExample`id`ID District.`1101010``regency_id`ID regency.`1101``name`District name.`TEUPAH SELATAN`Relationship nameModel`villages`[`Lushi\Models\Village`](#lushimodelsvillage)Model relationships
-------------------

[](#model-relationships)

Implementing an Eloquent relationship between a model in your app and a Lushi model is very simple. There are a couple of approaches you could take.

### Using inheritance

[](#using-inheritance)

The simplest option is to create a new model in your app, and let it extend the Lushi model. Your new app model will now behave like the original Lushi model, except you can register new methods and customise it to your liking:

```
