diff --git a/config/filament-currency.php b/config/filament-currency.php index 6ef5047..477f215 100644 --- a/config/filament-currency.php +++ b/config/filament-currency.php @@ -7,5 +7,5 @@ * we use it in the fallback to support the laravel-money version 5. */ 'default_currency' => env('CURRENCY_DEFAULT', env('MONEY_DEFAULTS_CURRENCY', config('money.defaults.currency', 'USD'))), - 'default_convert'=>env('MONEY_DEFAULTS_CONVERT',false) + 'default_convert' => env('MONEY_DEFAULTS_CONVERT', false), ]; diff --git a/src/FilamentCurrencyServiceProvider.php b/src/FilamentCurrencyServiceProvider.php index 6ddc67b..958bbbf 100644 --- a/src/FilamentCurrencyServiceProvider.php +++ b/src/FilamentCurrencyServiceProvider.php @@ -36,9 +36,10 @@ public function bootingPackage(): void if (blank($currency)) { $currency = config('filament-currency.default_currency'); } - if (is_null($shouldConvert)){ + if (is_null($shouldConvert)) { $shouldConvert = config('filament-currency.default_convert'); } + return (new Money\Money( $state, (new Money\Currency(strtoupper($evaluator->evaluate($currency)))), @@ -46,7 +47,7 @@ public function bootingPackage(): void ))->format(); }; - TextColumn::macro('currency', function (string | Closure | null $currency = null, bool|null $shouldConvert = null) use ($formatter): TextColumn { + TextColumn::macro('currency', function (string | Closure | null $currency = null, ?bool $shouldConvert = null) use ($formatter): TextColumn { /** * @var TextColumn $this */ @@ -58,7 +59,7 @@ public function bootingPackage(): void return $this; }); - Summarizers\Sum::macro('currency', function (string | Closure | null $currency = null, bool|null $shouldConvert = null) use ($formatter): Summarizers\Sum { + Summarizers\Sum::macro('currency', function (string | Closure | null $currency = null, ?bool $shouldConvert = null) use ($formatter): Summarizers\Sum { /** * @var Summarizers\Sum $this */ @@ -71,7 +72,7 @@ public function bootingPackage(): void return $this; }); - Summarizers\Average::macro('currency', function (string | Closure | null $currency = null, bool|null $shouldConvert = null) use ($formatter): Summarizers\Average { + Summarizers\Average::macro('currency', function (string | Closure | null $currency = null, ?bool $shouldConvert = null) use ($formatter): Summarizers\Average { /** * @var Summarizers\Average $this */ @@ -84,7 +85,7 @@ public function bootingPackage(): void return $this; }); - TextEntry::macro('currency', function (string | Closure | null $currency = null, bool|null $shouldConvert = null) use ($formatter): TextEntry { + TextEntry::macro('currency', function (string | Closure | null $currency = null, ?bool $shouldConvert = null) use ($formatter): TextEntry { /** * @var TextEntry $this */