osb/app/Models/Currency.php

31 lines
582 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Currency extends Model
{
2018-05-20 12:53:14 +00:00
// @todo - temp Until Implemented
protected $fillable = ['rounding'];
protected $table = 'ab_currency';
public $timestamps = FALSE;
2018-05-20 12:53:14 +00:00
const ROUND_HALF_UP = 1;
const ROUND_HALF_DOWN = 2;
const ROUND_HALF_EVEN = 3;
const ROUND_HALF_ODD = 4;
/**
* The accounts in this country
*/
public function countries()
{
2018-05-20 12:53:14 +00:00
return $this->hasMany(Country::class);
}
public function round($value,$mode=self::ROUND_HALF_UP)
{
return round($value,$this->rounding,$mode);
}
}