From afb0bb6c03b94624c2eed226ea8990181e4a8712 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Tue, 28 Nov 2017 16:39:30 +0300 Subject: [PATCH] close #99 --- app/Http/Controllers/Settings/Currencies.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Http/Controllers/Settings/Currencies.php b/app/Http/Controllers/Settings/Currencies.php index 05bad07b1..ef110aed2 100644 --- a/app/Http/Controllers/Settings/Currencies.php +++ b/app/Http/Controllers/Settings/Currencies.php @@ -29,10 +29,18 @@ class Currencies extends Controller */ public function create() { + // Get current currencies + $current = Currency::pluck('code')->toArray(); + // Prepare codes $codes = array(); $currencies = MoneyCurrency::getCurrencies(); foreach ($currencies as $key => $item) { + // Don't show if already available + if (in_array($key, $current)) { + continue; + } + $codes[$key] = $key; } @@ -77,10 +85,18 @@ class Currencies extends Controller */ public function edit(Currency $currency) { + // Get current currencies + $current = Currency::pluck('code')->toArray(); + // Prepare codes $codes = array(); $currencies = MoneyCurrency::getCurrencies(); foreach ($currencies as $key => $item) { + // Don't show if already available + if (($key != $currency->code) && in_array($key, $current)) { + continue; + } + $codes[$key] = $key; }