Skip to content

Commit

Permalink
Merge pull request #19 from ariaieboy/config
Browse files Browse the repository at this point in the history
use new laravel-money env for configuration
  • Loading branch information
ariaieboy authored Apr 1, 2024
2 parents cc9beac + 4405ba2 commit 191163f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions config/filament-currency.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
return [
/**
* Since we support laravel-money version >=1 we used `CURRENCY_DEFAULT` env that is used in laravel-money 1<=version<=4
* from version 5 laravel-money introduced a new config and env variable `MONEY_DEFAULTS_CURRENCY`
* 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'))),
];
3 changes: 2 additions & 1 deletion src/FilamentCurrencyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FilamentCurrencyServiceProvider extends PackageServiceProvider
public function configurePackage(Package $package): void
{
$package->name(static::$name)
->hasConfigFile()
->hasViews();
}

Expand All @@ -34,7 +35,7 @@ public function bootingPackage(): void
}

if (blank($currency)) {
$currency = env('DEFAULT_CURRENCY', 'USD');
$currency = config('filament-currency.default_currency');
}

return (new Money\Money(
Expand Down

0 comments on commit 191163f

Please sign in to comment.