From 7c78753a2d45968527a93c26eae7a62688fbbc4e Mon Sep 17 00:00:00 2001 From: Jeramy Simpson Date: Thu, 26 Mar 2015 15:13:31 +1000 Subject: [PATCH] L5 Syntax - Cache for Currency --- app/Libraries/Utils.php | 13 +++++++++---- resources/views/script.blade.php | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index c1457c238775..d1b2b9ba7f44 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -1,8 +1,11 @@ find($currencyId); - - if (!$currency) { - $currency = Currency::remember(DEFAULT_QUERY_CACHE)->find(1); + $currency = Currency::find($currencyId); + + if(!$currency){ + $currency = Currency::find(1); } + Cache::add('currency', $currency, DEFAULT_QUERY_CACHE); + return $currency->symbol.number_format($value, $currency->precision, $currency->decimal_separator, $currency->thousand_separator); } diff --git a/resources/views/script.blade.php b/resources/views/script.blade.php index 68e97c96727e..51af67f8b14f 100644 --- a/resources/views/script.blade.php +++ b/resources/views/script.blade.php @@ -1,6 +1,6 @@