<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class DailyRate extends Model
{
    use HasFactory;

    protected $table = 'daily_rates';

    protected $fillable = [
        'home_currency',     // references home_currencies.id
        'foreign_currency',  // references currencies.id
        'home_rate',
        'foreign_rate',
        'description',
    ];

    // Relationship to HomeCurrency
    public function homeCurrencyRelation()
    {
        return $this->belongsTo(\App\Models\HomeCurrency::class, 'home_currency');
    }

    // Relationship to Currency for foreign
    public function foreignCurrencyRelation()
    {
        return $this->belongsTo(\App\Models\Currency::class, 'foreign_currency');
    }
}
