Currency Api Dashboard

TypeScript

Modern currency exchange rate dashboard with real-time market data, conversion tools, analytics, historical trends, and responsive admin interface.

Stars
18
Forks
1
Downloads
N/A
Open Issues
0
Files main

Repository Files

Loading file structure...
app/Models/Country.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Country extends Model
{
    protected $fillable = [
        'id',
        'name',
        'sortname',
        'currency_code',
        'phone_code',
    ];

    protected $hidden = [
        'id',
        'sortname',
        'created_at',
        'updated_at',
    ];

    protected $appends = [
        'iso_code',
    ];

    /**
     * Get the ISO 2-letter code for the country.
     */
    public function getIsoCodeAttribute(): ?string
    {
        return $this->sortname;
    }

    /**
     * Get the states for the country.
     */
    public function states(): HasMany
    {
        return $this->hasMany(State::class);
    }

    /**
     * Get the currency used by the country.
     */
    public function currency(): BelongsTo
    {
        return $this->belongsTo(Currency::class, 'currency_code', 'code');
    }
}