From 5708b9c0e99bffb8fcf6b62b407442926e243b67 Mon Sep 17 00:00:00 2001 From: TheCOBAN Date: Sat, 18 Apr 2020 21:46:28 +0300 Subject: [PATCH] Fixed: wizard currency --- app/Http/Controllers/Settings/Currencies.php | 6 ++++-- resources/views/wizard/currencies/index.blade.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Settings/Currencies.php b/app/Http/Controllers/Settings/Currencies.php index 916845ee5..767e29780 100644 --- a/app/Http/Controllers/Settings/Currencies.php +++ b/app/Http/Controllers/Settings/Currencies.php @@ -229,14 +229,16 @@ class Currencies extends Controller public function config() { - $json = new \stdClass(); + $json = new \stdClass(); $code = request('code'); + $currencies = Currency::all()->pluck('rate', 'code'); + if ($code) { $currency = config('money.' . $code); - $currency['rate'] = isset($currency['rate']) ? $currency['rate'] : null; + $currency['rate'] = isset($currencies[$code]) ? $currencies[$code] : null; $currency['symbol_first'] = $currency['symbol_first'] ? 1 : 0; $json = (object) $currency; diff --git a/resources/views/wizard/currencies/index.blade.php b/resources/views/wizard/currencies/index.blade.php index 9a90341c6..e77eb2508 100644 --- a/resources/views/wizard/currencies/index.blade.php +++ b/resources/views/wizard/currencies/index.blade.php @@ -84,7 +84,7 @@ {{ Form::textGroup('name', trans('general.name'), 'font', [], null, '') }} - {{ Form::selectGroup('code', trans('currencies.code'), 'code', $codes, null, ['required' => 'required', 'change' => 'onChangeCode'], '') }} + {{ Form::selectGroup('code', trans('currencies.code'), 'code', $codes, null, ['required' => 'required', 'change' => 'onChangeCode', 'model' => 'form.code'], '') }} {{ Form::textGroup('rate', trans('currencies.rate'), 'percentage', ['required' => 'required'], null, '') }}