Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Oct 8, 2020
1 parent 6d1624e commit e8ce539
Show file tree
Hide file tree
Showing 3 changed files with 1,085 additions and 967 deletions.
129 changes: 123 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Laravel Squire 📜

Squire is a collection of static Eloquent models for fixture data that is commonly needed in web applications, such as countries, currencies and airports. It's built on top of [Caleb Porzio's Sushi package](https://github.com/calebporzio/sushi).
Squire is a library of static Eloquent models for fixture data that is commonly needed in web applications, such as countries, currencies and airports. It's built on top of [Caleb Porzio's Sushi package](https://github.com/calebporzio/sushi).

Common use cases for Squire include:
- Populating dropdown options, such as a country selector on an address form.
Expand All @@ -11,6 +11,20 @@ Common use cases for Squire include:
[![Latest Stable Version](https://packagist.org/packages/danharrin/squire")](https://poser.pugx.org/danharrin/squire/v/stable.svg)
[![License](https://packagist.org/packages/danharrin/squire")](https://poser.pugx.org/danharrin/squire/license.svg)

- [Installing Squire](#installing-squire)
- [Using a model](#using-a-model)
- [Available models](#available-models)
- [`Squire\Models\Airline`](#squiremodelsairline)
- [`Squire\Models\Airport`](#squiremodelsairport)
- [`Squire\Models\Continent`](#squiremodelscontinent)
- [`Squire\Models\Counties\GbCounty`](#squiremodelscountiesgbcounty)
- [`Squire\Models\Country`](#squiremodelscountry)
- [`Squire\Models\Currency`](#squiremodelscurrency)
- [`Squire\Models\Region`](#squiremodelsregion)
- [Model relationships](#model-relationships)
- [Column customisation](#column-customisation)
- [Contributing](#contributing)

## Installing Squire

You can use Composer to install Squire into your application.
Expand All @@ -37,13 +51,116 @@ Country::where('name', 'like', 'a%')->get(); // Get information about all countr

## Available models

### `Squire\Models\Airline`

| Column Name | Description | Example |
|--|--|--|
| `alias` | Alternative name of the airline. | `EasyJet Airline` |
| `call_sign` | Call sign of the airline. | `EASY` |
| `code_iata` | [IATA code](https://en.wikipedia.org/wiki/List_of_airline_codes) of the airline. | `u2` |
| `code_icao` | [ICAO code](https://en.wikipedia.org/wiki/List_of_airline_codes) of the airline. |`ezy` |
| `country_id` | [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the airline. | `gb` |
| `name` | Name of the airline. | `easyJet` |

| Relationship name | Model |
|--|--|
| `country` | [`Squire\Models\Country`](#squiremodelscountry) |
| `continent` | [`Squire\Models\Continent`](#squiremodelscontinent) |


### `Squire\Models\Airport`

| Column Name | Description | Example |
|--|--|--|
| `code_gps` | GPS code of the airport. | `ayse` |
| `code_iata` | [IATA code](https://en.wikipedia.org/wiki/IATA_airport_code) of the airport. | `nis` |
| `code_icao` | Local code of the airport. |`sbi` |
| `municipality` | Municipality of the airport. | `Simberi Island` |
| `name` | Name of the airport. | `Simberi Airport` |
| `region_id` | [ISO 3166-2 region code](https://en.wikipedia.org/wiki/ISO_3166-2) of the airport. | `pg-nik` |
| `type` | Type of airport. | `small_airport` |

| Relationship name | Model |
|--|--|
| `country` | [`Squire\Models\Country`](#squiremodelscountry) |
| `region` | [`Squire\Models\Region`](#squiremodelsregion) |

### `Squire\Models\Continent`

| Column Name | Description | Example |
|--|--|--|
| `code` | Two letter continent code. | `na` |
| `name` | Continent name. | `North America` |

| Relationship name | Model |
|--|--|
| `countries` | [`Squire\Models\Country`](#squiremodelscountry) |
| `regions` | [`Squire\Models\Region`](#squiremodelsregion) |

### `Squire\Models\Counties\GbCounty`

| Column Name | Description | Example |
|--|--|--|
| `code` | [ISO 3166-2 county code](https://en.wikipedia.org/wiki/ISO_3166-2). | `gb-ess` |
| `name` | County name. | `Essex` |
| `region_id` | [ISO 3166-2 region code](https://en.wikipedia.org/wiki/ISO_3166-2) of the county. | `gb-eng` |

| Relationship name | Model |
|--|--|
| `region` | [`Squire\Models\Region`](#squiremodelsregion) |

### `Squire\Models\Country`

| Column Name | Description | Example | Notes |
|----------------|--------------------------------------------------------------------------------------|-----------------|-------------|
| `id` | [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code. | `us` | Primary key |
| `calling_code` | [E.164](https://en.wikipedia.org/wiki/E.164) country calling code. | `1` | |
| `name` | Country name. | `United States` | |
| Column Name | Description | Example |
|--|--|--|
| `calling_code` | [E.164](https://en.wikipedia.org/wiki/E.164) country calling code. | `1` |
| `capital_city` | Capital city of the country. | `Washington` |
| `code_2` | [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | `us` |
| `code_3` | [ISO 3166-1 alpha-3 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3). | `usa` |
| `continent_id` | Two letter continent code of the country. | `na` |
| `currency_id` | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) alphabetic currency code of the country. | `usd` |
| `flag` | Unicode flag of the country. | `🇺🇸` |
| `name` | Country name. | `United States` |

| Relationship name | Model |
|--|--|
| `airlines` | [`Squire\Models\Airline`](#squiremodelsairline) |
| `airports` | [`Squire\Models\Airport`](#squiremodelsairport) |
| `continent` | [`Squire\Models\Continent`](#squiremodelscontinent) |
| `currency` | [`Squire\Models\Currency`](#squiremodelscurrency) |
| `regions` | [`Squire\Models\Region`](#squiremodelsregion) |

### `Squire\Models\Currency`

| Column Name | Description | Example |
|--|--|--|
| `code_alphabetic` | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) alphabetic currency code. | `usd` |
| `code_numeric` | [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) numeric currency code. | `840` |
| `decimal_digits` | Number of decimal digits to use when formatting this currency. | `United States` |
| `name` | Currency name. | `US Dollar` |
| `name_plural` | Plural currency name. | `US Dollars` |
| `rounding` | The formatting precison of this currency. | `0` |
| `symbol` | International currency symbol. | `$` |
| `symbol_native` | Native currency symbol. | `$` |

| Relationship name | Model |
|--|--|
| `countries` | [`Squire\Models\Country`](#squiremodelscountry) |

### `Squire\Models\Region`

| Column Name | Description | Example |
|--|--|--|
| `code` | [ISO 3166-2 region code](https://en.wikipedia.org/wiki/ISO_3166-2). | `us-ny` |
| `country_id` | [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | `us` |
| `name` | Region name. | `New York` |

| Relationship name | Model |
|--|--|
| `airports` | [`Squire\Models\Airport`](#squiremodelsairport) |
| `continent` | [`Squire\Models\Continent`](#squiremodelscontinent) |
| `country` | [`Squire\Models\Country`](#squiremodelscountry) |
| `gbCounties` | [`Squire\Models\County\GbCounty`](#squiremodelscountiesgbcounty) |

## Model relationships

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "danharrin/squire",
"description": "A collection of static Eloquent models for common fixture data.",
"description": "A library of static Eloquent models for common fixture data.",
"keywords": [
"squire",
"squire",
"eloquent",
"model",
"sushi",
"laravel"
],
"homepage": "https://github.com/danharrin/squire",
Expand Down
Loading

0 comments on commit e8ce539

Please sign in to comment.