diff options
author | Calvin Morrison <calvin@fastmailteam.com> | 2022-08-02 14:36:09 -0400 |
---|---|---|
committer | Calvin Morrison <calvin@fastmailteam.com> | 2022-08-02 14:36:09 -0400 |
commit | f2aff7518be55da0fd250e04a4bfc1bbbd5a3d0a (patch) | |
tree | 6d5a54ecaf98175aa9db2ebfbf3182c8f3ddf2b3 /app/Models | |
parent | 2466d29fe2319c1057cca7cf1e1977451088276e (diff) |
data model, query and storage works, frontend display basic last report
Diffstat (limited to 'app/Models')
-rw-r--r-- | app/Models/Currency.php | 14 | ||||
-rw-r--r-- | app/Models/Rates.php | 23 |
2 files changed, 37 insertions, 0 deletions
diff --git a/app/Models/Currency.php b/app/Models/Currency.php new file mode 100644 index 0000000..f64bf15 --- /dev/null +++ b/app/Models/Currency.php @@ -0,0 +1,14 @@ +<?php + +namespace App\Models; + +use Illuminate\Database\Eloquent\Model; + +class Currency extends Model +{ + protected $connection = 'sqlite'; + protected $table = 'currency'; + protected $fillable = [ + 'name', 'unit', 'description' +]; +}; diff --git a/app/Models/Rates.php b/app/Models/Rates.php new file mode 100644 index 0000000..5cabf1e --- /dev/null +++ b/app/Models/Rates.php @@ -0,0 +1,23 @@ +<?php + +namespace App\Models; + +use Illuminate\Database\Eloquent\Model; + +class Rates extends Model +{ + protected $connection = 'sqlite'; + + protected $fillable = [ + 'currency', 'relative', 'value' + ]; + + public function currency() + { + return $this->belongsTo(Currency::class, 'currency_id'); + } + public function relative() + { + return $this->belongsTo(Currency::class, 'relative_id'); + } +} |