'float', ]; } public function currency(): BelongsTo { return $this->belongsTo(Currency::class); } public function company(): BelongsTo { return $this->belongsTo(Company::class); } /** * Create an exchange rate log entry from a document model (invoice, estimate, etc.) * using its exchange rate, currency, and the company's default currency setting. */ public static function addExchangeRateLog(mixed $model): self { $data = [ 'exchange_rate' => $model->exchange_rate, 'company_id' => $model->company_id, 'base_currency_id' => $model->currency_id, 'currency_id' => CompanySetting::getSetting('currency', $model->company_id), ]; return self::create($data); } }