osb/app/Models/Currency.php

29 lines
463 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Currency extends Model
{
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;
2021-12-17 03:59:55 +00:00
/* RELATIONS */
public function country()
{
2021-12-17 03:59:55 +00:00
return $this->hasOne(Country::class);
2018-05-20 12:53:14 +00:00
}
2021-12-17 03:59:55 +00:00
/* METHODS */
2018-05-20 12:53:14 +00:00
public function round($value,$mode=self::ROUND_HALF_UP)
{
return round($value,$this->rounding,$mode);
}
}