osb/app/Models/Currency.php
2018-05-20 22:53:14 +10:00

31 lines
582 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Currency extends Model
{
// @todo - temp Until Implemented
protected $fillable = ['rounding'];
protected $table = 'ab_currency';
public $timestamps = FALSE;
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()
{
return $this->hasMany(Country::class);
}
public function round($value,$mode=self::ROUND_HALF_UP)
{
return round($value,$this->rounding,$mode);
}
}