28 lines
704 B
PHP
28 lines
704 B
PHP
|
<?php
|
||
|
namespace ProVM\Money;
|
||
|
|
||
|
use Carbon\CarbonInterval;
|
||
|
use ProVM\Common\Alias\Model;
|
||
|
|
||
|
/**
|
||
|
* @property int $id
|
||
|
* @property Currency $currency_id
|
||
|
* @property string $url
|
||
|
* @property \DateInterval $frecuency
|
||
|
*/
|
||
|
class Source extends Model {
|
||
|
protected $currency;
|
||
|
public function currency(): ?Currency {
|
||
|
if ($this->currency === null) {
|
||
|
$this->currency = $this->childOf(Currency::class, [Model::SELF_KEY => 'currency_id']);
|
||
|
}
|
||
|
return $this->currency;
|
||
|
}
|
||
|
public function frecuency(\DateInterval $frecuency = null) {
|
||
|
if ($frecuency == null) {
|
||
|
return new \CarbonInterval($this->fecuency);
|
||
|
}
|
||
|
$this->frecuency = CarbonInterval::getDateIntervalSpec($frecuency);
|
||
|
}
|
||
|
}
|