Create ConversionRate model and its migration
ADD
app/Models/ConversionRate.php
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ConversionRate extends Model
+{
+ public function base()
+ {
+ return $this->belongsTo(Currency::class);
+ }
+
+ public function target()
+ {
+ return $this->belongsTo(Currency::class);
+ }
+}

ADD
database/migrations/2020_06_28_202633_create_conversion_rates_table.php
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateConversionRatesTable extends Migration
+{
+ public function up(): void
+ {
+ Schema::create('conversion_rates', function (Blueprint $table) {
+ $table->id();
+ $table->unsignedInteger('base_currency_id');
+ $table->unsignedInteger('target_currency_id');
+ $table->float('rate');
+ $table->timestamps();
+ });
+ }
+
+ public function down(): void
+ {
+ Schema::dropIfExists('conversion_rates');
+ }
+}

Create ConversionRate model and its migration