From 5921890ee7be8b9d77a3ee2d3ced0cc532630675 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Mon, 15 Mar 2021 17:41:39 -0300 Subject: [PATCH] Models --- src/Currency.php | 20 ++++++++++++++++++++ src/Value.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/Currency.php create mode 100644 src/Value.php diff --git a/src/Currency.php b/src/Currency.php new file mode 100644 index 0000000..ffdfdce --- /dev/null +++ b/src/Currency.php @@ -0,0 +1,20 @@ +values === null) { + $this->values = $this->parentOf(Value::class, [Model::CHILD_KEY => 'currency_id']); + } + } +} diff --git a/src/Value.php b/src/Value.php new file mode 100644 index 0000000..319d73a --- /dev/null +++ b/src/Value.php @@ -0,0 +1,32 @@ +currency === null) { + $this->currency = $this->childOf(Currency::class, [Model::SELF_KEY => 'currency_id']); + } + return $this->currency; + } + protected $base; + public function base(): ?Currency { + if ($this->base === null) { + $this->base = $this->childOf(Currency::class, [Model::SELF_KEY => 'base_id']); + } + return $this->base; + } +}