From 5f1cd87102032155428d235b276b825d673c4228 Mon Sep 17 00:00:00 2001 From: datasolutionsbz <125493645+datasolutionsbz@users.noreply.github.com> Date: Fri, 10 Mar 2023 22:34:57 -0600 Subject: [PATCH] Create 2023_03_10_100629_add_currencies.php Add Belize Currency --- .../2023_03_10_100629_add_currencies.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 database/migrations/2023_03_10_100629_add_currencies.php diff --git a/database/migrations/2023_03_10_100629_add_currencies.php b/database/migrations/2023_03_10_100629_add_currencies.php new file mode 100644 index 0000000000..b0a15d6a7d --- /dev/null +++ b/database/migrations/2023_03_10_100629_add_currencies.php @@ -0,0 +1,47 @@ + 114, 'name' => 'BZ Dollar', 'code' => 'BZD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'], + ]; + + foreach ($currencies as $currency) { + $record = Currency::whereCode($currency['code'])->first(); + if ($record) { + $record->name = $currency['name']; + $record->symbol = $currency['symbol']; + $record->precision = $currency['precision']; + $record->thousand_separator = $currency['thousand_separator']; + $record->decimal_separator = $currency['decimal_separator']; + if (isset($currency['swap_currency_symbol'])) { + $record->swap_currency_symbol = $currency['swap_currency_symbol']; + } + $record->save(); + } else { + Currency::create($currency); + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +};