Skip to content

Commit

Permalink
Timezones package
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Oct 4, 2021
1 parent b3a4d6d commit 72374ff
Show file tree
Hide file tree
Showing 34 changed files with 1,466 additions and 821 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Common use cases for Squire include:
- [Formatting money](#formatting-money)
- [`Squire\Models\GbCounty`](#squiremodelsgbcounty)
- [`Squire\Models\Region`](#squiremodelsregion)
- [`Squire\Models\Timezone`](#squiremodelstimezone)
- [Model Relationships](#model-relationships)
- [Validation](#validation)
- [Creating your own Models](#creating-your-own-models)
Expand Down Expand Up @@ -258,6 +259,36 @@ This functionality uses [`akaunting/laravel-money`](https://github.com/akaunting
| `country` | [`Squire\Models\Country`](#squiremodelscountry) |
| `gbCounties` | [`Squire\Models\GbCounty`](#squiremodelsgbcounty) |

### `Squire\Models\Timezone`

#### Installation

| Locale | Installation Command |
|--|--|
| English | `composer require squirephp/timezones-en` |

#### Schema

| Column Name | Description | Example |
|--|--|--|
| `code` | [PHP timezone identifier](https://www.php.net/manual/en/timezones.php). | `America/New_York` |
| `country_id` | [ISO 3166-1 alpha-2 country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). | `us` |
| `long_name` | Full timezone name. | `America/New York` |
| `name` | Short timezone name. | `New York` |

#### Relationships

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

#### Methods

| Method name | Description |
|--|--|
| `getOffset($dateTime)` | Returns the timezone offset from GMT. |

## Model Relationships

Implementing an Eloquent relationship between a model in your app and a Squire model is very simple. There are a couple of approaches you could take.
Expand Down
17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"require": {
"php": "^8.0",
"illuminate/contracts": "^8.0",
"illuminate/database": "^6.0 || ^7.0 || ^8.40.0",
"illuminate/database": "^8.0",
"illuminate/support": "^8.0",
"akaunting/laravel-money": "^1.2"
},
Expand Down Expand Up @@ -41,7 +41,9 @@
"packages/regions-en/src",
"packages/regions/src",
"packages/repository/src",
"packages/rule/src"
"packages/rule/src",
"packages/timezones-en/src",
"packages/timezones/src"
]
}
},
Expand All @@ -53,9 +55,6 @@
"extra": {
"laravel": {
"providers": [
"Squire\\GbCountiesServiceProvider",
"Squire\\ContinentsDeServiceProvider",
"Squire\\ContinentsEnServiceProvider",
"Squire\\AirportsServiceProvider",
"Squire\\CountriesDeServiceProvider",
"Squire\\AirlinesServiceProvider",
Expand All @@ -72,7 +71,9 @@
"Squire\\CurrenciesEnServiceProvider",
"Squire\\CurrenciesServiceProvider",
"Squire\\RegionsServiceProvider",
"Squire\\RepositoryServiceProvider"
"Squire\\RepositoryServiceProvider",
"Squire\\TimezonesServiceProvider",
"Squire\\TimezonesEnServiceProvider"
],
"aliases": {
"RepositoryManager": "Squire\\Repository\\Facades\\Repository"
Expand All @@ -99,6 +100,8 @@
"squirephp/regions": "self.version",
"squirephp/regions-en": "self.version",
"squirephp/repository": "self.version",
"squirephp/rule": "self.version"
"squirephp/rule": "self.version",
"squirephp/timezones": "self.version",
"squirephp/timezones-en": "self.version"
}
}
78 changes: 39 additions & 39 deletions packages/airlines-en/composer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"name": "squirephp/airlines-en",
"description": "A library containing the English translation of Squire's Airline model.",
"keywords": [
"squire"
],
"license": "MIT",
"homepage": "https://github.com/squirephp",
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"authors": [
{
"name": "Dan Harrin",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.0",
"squirephp/airlines": "^2.0",
"squirephp/repository": "^2.0"
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Squire\\AirlinesEnServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
"name": "squirephp/airlines-en",
"description": "A library containing the English translation of Squire's Airline model.",
"keywords": [
"squire"
],
"license": "MIT",
"homepage": "https://github.com/squirephp",
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"authors": [
{
"name": "Dan Harrin",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.0",
"squirephp/airlines": "self.version",
"squirephp/repository": "self.version"
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Squire\\AirlinesEnServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
}
78 changes: 39 additions & 39 deletions packages/airlines/composer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"name": "squirephp/airlines",
"description": "A library containing Squire's Airline model.",
"keywords": [
"squire"
],
"license": "MIT",
"homepage": "https://github.com/squirephp",
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"authors": [
{
"name": "Dan Harrin",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.0",
"squirephp/model": "^2.0",
"squirephp/rule": "^2.0"
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Squire\\AirlinesServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
"name": "squirephp/airlines",
"description": "A library containing Squire's Airline model.",
"keywords": [
"squire"
],
"license": "MIT",
"homepage": "https://github.com/squirephp",
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"authors": [
{
"name": "Dan Harrin",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.0",
"squirephp/model": "self.version",
"squirephp/rule": "self.version"
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Squire\\AirlinesServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
}
78 changes: 39 additions & 39 deletions packages/airports-en/composer.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"name": "squirephp/airports-en",
"description": "A library containing the English translation of Squire's Airport model.",
"keywords": [
"squire"
],
"license": "MIT",
"homepage": "https://github.com/squirephp",
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"authors": [
{
"name": "Dan Harrin",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.0",
"squirephp/airports": "^2.0",
"squirephp/repository": "^2.0"
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Squire\\AirportsEnServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
"name": "squirephp/airports-en",
"description": "A library containing the English translation of Squire's Airport model.",
"keywords": [
"squire"
],
"license": "MIT",
"homepage": "https://github.com/squirephp",
"support": {
"issues": "https://github.com/squirephp/squire/issues",
"source": "https://github.com/squirephp/squire"
},
"authors": [
{
"name": "Dan Harrin",
"email": "[email protected]"
}
],
"require": {
"php": "^8.0",
"illuminate/support": "^8.0",
"squirephp/airports": "self.version",
"squirephp/repository": "self.version"
},
"autoload": {
"psr-4": {
"Squire\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"Squire\\AirportsEnServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
}
Loading

0 comments on commit 72374ff

Please sign in to comment.