https://github.com/brokeyourbike/country-casts-laravel
Cast Laravel country code attributes from ISO3 to ISO2
https://github.com/brokeyourbike/country-casts-laravel
attributes casting eloquent hacktoberfest laravel laravel-8 laravel-8-package laravel-package php php8
Last synced: 4 months ago
JSON representation
Cast Laravel country code attributes from ISO3 to ISO2
- Host: GitHub
- URL: https://github.com/brokeyourbike/country-casts-laravel
- Owner: brokeyourbike
- License: mpl-2.0
- Created: 2021-12-21T15:02:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-20T11:34:06.000Z (about 2 years ago)
- Last Synced: 2025-01-14T12:25:40.650Z (6 months ago)
- Topics: attributes, casting, eloquent, hacktoberfest, laravel, laravel-8, laravel-8-package, laravel-package, php, php8
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# country-casts-laravel
[](https://github.com/brokeyourbike/country-casts-laravel/releases)
[](https://packagist.org/packages/brokeyourbike/country-casts-laravel)
[](https://codeclimate.com/github/brokeyourbike/country-casts-laravel/maintainability)
[](https://codeclimate.com/github/brokeyourbike/country-casts-laravel/test_coverage)Cast country code attributes from ISO3 to ISO2
## Installation
```bash
composer require brokeyourbike/country-casts-laravel
```## Usage
```php
use Illuminate\Database\Eloquent\Model;
use BrokeYourBike\CountryCasts\Alpha2Cast;class Order extends Model
{
protected $casts = [
'country_code' => 'string',
'country_code_alpha2' => Alpha2Cast::class . ':country_code',
];
}
```## Authors
- [Ivan Stasiuk](https://github.com/brokeyourbike) | [Twitter](https://twitter.com/brokeyourbike) | [LinkedIn](https://www.linkedin.com/in/brokeyourbike) | [stasi.uk](https://stasi.uk)## License
[Mozilla Public License v2.0](https://github.com/brokeyourbike/country-casts-laravel/blob/main/LICENSE)