Skip to content

Commit ae39d69

Browse files
committed
Use and default to fallback currency
1 parent 5d3472c commit ae39d69

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Augmentables/AugmentedCurrency.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function formattedNoSymbol()
110110
*/
111111
public function iso(): string|null
112112
{
113-
return Arr::get($this->data->config, 'iso');
113+
return Arr::get($this->data->config, 'iso', Currencies::$fallbackCurrency);
114114
}
115115

116116
/**

src/Fieldtypes/CurrencyFieldtype.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function configFieldItems(): array
102102
'display' => 'Currency',
103103
'instructions' => 'Select which currency you want to use for the field.',
104104
'type' => 'select',
105-
'default' => 'USD',
105+
'default' => Currencies::$fallbackCurrency,
106106
'options' => collect(Currencies::$currencyList)
107107
->map(fn($item, $key) => Arr::get($item, 'name') . " ($key)")
108108
->sortBy(fn($val) => $val),
@@ -168,7 +168,7 @@ public function augment($value)
168168
*/
169169
private function getIso(): string
170170
{
171-
return Arr::get($this->field()->config(), 'iso', 'USD');
171+
return Arr::get($this->field()->config(), 'iso', Currencies::$fallbackCurrency);
172172
}
173173

174174
private function convertToStorage($value)

0 commit comments

Comments
 (0)