keios/oc-trait-financial

Financial trait for OctoberCMS' models.

v1.0.1 2023-10-13 18:01 UTC

This package is not auto-updated.

Last update: 2024-11-09 17:03:54 UTC


README

Latest Version Software License Total Downloads

Trait for OctoberCMS' models providing Keios/MoneyRight value object integration.

Install

Via Composer

$ composer require keios/oc-trait-financial

Usage

class Account extends Model {           // example model extending October's October\Rain\Database\Model
    use \Keios\Financial\Financial;

    protected $financial = [
        'balance' => [                  // $model->balance instanceof \Keios\MoneyRight\Money // true
            'balance'  => 'amount',     // amount   : decimal(12,4) field in database
            'currency' => 'currency'    // currency : varchar(3) field in database
        ]
    ];
}

Security

If you discover any security related issues, please email lukasz@c-call.eu instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.