您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CreateCurrency.php 828B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Actions\OptionAction;
  3. use App\Models\Setting\Currency;
  4. class CreateCurrency
  5. {
  6. public function create(string $code, string $name, string $rate): Currency
  7. {
  8. $defaultCurrency = Currency::getDefaultCurrency();
  9. $hasDefaultCurrency = $defaultCurrency !== null;
  10. return Currency::create([
  11. 'name' => $name,
  12. 'code' => $code,
  13. 'rate' => $rate,
  14. 'precision' => config("money.{$code}.precision"),
  15. 'symbol' => config("money.{$code}.symbol"),
  16. 'symbol_first' => config("money.{$code}.symbol_first"),
  17. 'decimal_mark' => config("money.{$code}.decimal_mark"),
  18. 'thousands_separator' => config("money.{$code}.thousands_separator"),
  19. 'enabled' => !$hasDefaultCurrency,
  20. ]);
  21. }
  22. }