|
@@ -16,11 +16,11 @@ class RateCast implements CastsAttributes
|
16
|
16
|
return '0';
|
17
|
17
|
}
|
18
|
18
|
|
19
|
|
- $currency_code = $this->getDefaultCurrencyCode();
|
|
19
|
+ $currencyCode = $attributes['currency_code'] ?? $this->getDefaultCurrencyCode();
|
20
|
20
|
$computation = AdjustmentComputation::parse($attributes['computation'] ?? $attributes['discount_computation'] ?? null);
|
21
|
21
|
|
22
|
22
|
if ($computation?->isFixed()) {
|
23
|
|
- return money($value, $currency_code)->formatSimple();
|
|
23
|
+ return money($value, $currencyCode)->formatSimple();
|
24
|
24
|
}
|
25
|
25
|
|
26
|
26
|
return RateCalculator::formatScaledRate($value);
|
|
@@ -38,10 +38,10 @@ class RateCast implements CastsAttributes
|
38
|
38
|
|
39
|
39
|
$computation = AdjustmentComputation::parse($attributes['computation'] ?? $attributes['discount_computation'] ?? null);
|
40
|
40
|
|
41
|
|
- $currency_code = $this->getDefaultCurrencyCode();
|
|
41
|
+ $currencyCode = $attributes['currency_code'] ?? $this->getDefaultCurrencyCode();
|
42
|
42
|
|
43
|
43
|
if ($computation?->isFixed()) {
|
44
|
|
- return money($value, $currency_code, true)->getAmount();
|
|
44
|
+ return money($value, $currencyCode, true)->getAmount();
|
45
|
45
|
}
|
46
|
46
|
|
47
|
47
|
return RateCalculator::parseLocalizedRate($value);
|