Looking to hire Laravel developers? Try LaraJobs

money-casts-laravel maintained by brokeyourbike

Description
Cast attributes to Money object
Author
Last update
2023/05/20 13:40 (dev-release-v1.0.5)
License
Links
Downloads
509

Comments
comments powered by Disqus

money-casts-laravel

Latest Stable Version Total Downloads Maintainability Test Coverage

Cast attributes to Money objects

Installation

composer require brokeyourbike/money-casts-laravel

Usage

use Illuminate\Database\Eloquent\Model;
use BrokeYourBike\MoneyCasts\CurrencyCast;
use BrokeYourBike\MoneyCasts\MoneyCast;

class Order extends Model
{
    protected $casts = [
        'currency' => CurrencyCast::class . ':currency_code',
        'amount' => MoneyCast::class . ':amount_in_cents,currency_code',
    ];
}

Authors

License

Mozilla Public License v2.0