From 479a710cb69c01a173127f24a89d764acceb6c0c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 1 Feb 2018 09:32:29 +0200 Subject: [PATCH] Support setting conversion base currency --- app/Console/Commands/SendReminders.php | 2 +- config/ninja.php | 1 + resources/views/money_script.blade.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/SendReminders.php b/app/Console/Commands/SendReminders.php index 4d0788cdaf08..9e3a5640e506 100644 --- a/app/Console/Commands/SendReminders.php +++ b/app/Console/Commands/SendReminders.php @@ -190,7 +190,7 @@ class SendReminders extends Command $data = CurlUtils::get(config('ninja.exchange_rates_url')); $data = json_decode($data); - Currency::whereCode('EUR')->update(['exchange_rate' => 1]); + Currency::whereCode(config('ninja.exchange_rates_base'))->update(['exchange_rate' => 1]); foreach ($data->rates as $code => $rate) { Currency::whereCode($code)->update(['exchange_rate' => $rate]); diff --git a/config/ninja.php b/config/ninja.php index 065a0979a5f9..7a9b9b3fb0c9 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -21,5 +21,6 @@ return [ // data services 'exchange_rates_url' => env('EXCHANGE_RATES_URL', 'https://api.fixer.io/latest'), + 'exchange_rates_base' => env('EXCHANGE_RATES_BASE', 'EUR'), ]; diff --git a/resources/views/money_script.blade.php b/resources/views/money_script.blade.php index 41476eb07488..4eb87f3bd50a 100644 --- a/resources/views/money_script.blade.php +++ b/resources/views/money_script.blade.php @@ -15,7 +15,7 @@ countryMap[country.id] = country; } - fx.base = 'EUR'; + fx.base = '{{ config('ninja.exchange_rates_base') }}'; fx.rates = {!! cache('currencies') ->keyBy('code') ->map(function($item, $key) {