Added Sources
This commit is contained in:
27
src/Source.php
Normal file
27
src/Source.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user