brokeyourbike/country-casts-laravel

Cast Laravel country code attributes from ISO3 to ISO2

0.1.2 2023-05-14 22:33 UTC

This package is auto-updated.

Last update: 2024-03-20 13:16:58 UTC


README

Latest Stable Version Total Downloads Maintainability Test Coverage

Cast country code attributes from ISO3 to ISO2

Installation

composer require brokeyourbike/country-casts-laravel

Usage

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

License

Mozilla Public License v2.0