29 lines
463 B
PHP
29 lines
463 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Currency extends Model
|
|
{
|
|
public $timestamps = FALSE;
|
|
|
|
const ROUND_HALF_UP = 1;
|
|
const ROUND_HALF_DOWN = 2;
|
|
const ROUND_HALF_EVEN = 3;
|
|
const ROUND_HALF_ODD = 4;
|
|
|
|
/* RELATIONS */
|
|
|
|
public function country()
|
|
{
|
|
return $this->hasOne(Country::class);
|
|
}
|
|
|
|
/* METHODS */
|
|
|
|
public function round($value,$mode=self::ROUND_HALF_UP)
|
|
{
|
|
return round($value,$this->rounding,$mode);
|
|
}
|
|
} |