Refactor the currency management system to eliminate the redundant `rate_to_aed` field and transition to a single-base model where all rates are stored relative to the Iranian Rial (IRR). Key changes: - Removed `rate_to_aed` from `currencies` table via new migration. - Updated `ExchangeRateService` to handle rates using a single `currency_code` parameter instead of currency pairs. - Refactored `UpdateExchangeRates` command to fetch rates from the Exir.io API and support multiple currencies (AED, USD, EUR, CNY). - Updated Filament resources (`CurrencyResource`, `ExchangeRateHistoryResource`) and widgets to reflect the new single-base architecture. - Improved `PriceCalculatorService` to use the updated service methodology for fetching the AED/IRR conversion rate. - Localized console command output to Persian.
20 lines
361 B
PHP
20 lines
361 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Currency extends Model
|
|
{
|
|
protected $fillable = [
|
|
'code', 'name', 'symbol', 'rate_to_rial', 'is_active',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'rate_to_rial' => 'decimal:4',
|
|
'is_active' => 'boolean',
|
|
];
|
|
}
|
|
} |