Fixes
This commit is contained in:
@ -16,9 +16,21 @@ class Currency extends Model {
|
||||
public function values(): ?array {
|
||||
if ($this->values === null) {
|
||||
$this->values = $this->parentOf(Value::class, [Model::CHILD_KEY => 'currency_id']);
|
||||
if ($this->values) {
|
||||
usort($this->values, function($a, $b) {
|
||||
return $b->dateTime()->timestamp - $a->dateTime()->timestamp;
|
||||
});
|
||||
}
|
||||
}
|
||||
return $this->values;
|
||||
}
|
||||
protected $latest;
|
||||
public function latest(): ?Value {
|
||||
if ($this->latest === null) {
|
||||
$this->latest = $this->values()[0];
|
||||
}
|
||||
return $this->latest;
|
||||
}
|
||||
|
||||
protected static $fields = ['code', 'name'];
|
||||
public static function add(ModelFactory $factory, $info) {
|
||||
|
Reference in New Issue
Block a user