mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
L5 Syntax - Cache for Currency
This commit is contained in:
parent
de1a5252ec
commit
7c78753a2d
@ -1,8 +1,11 @@
|
||||
<?php namespace App\Libraries;
|
||||
|
||||
use Auth;
|
||||
use Cache;
|
||||
use DB;
|
||||
use Schema;
|
||||
use Session;
|
||||
use App\Models\Currency;
|
||||
|
||||
class Utils
|
||||
{
|
||||
@ -221,12 +224,14 @@ class Utils
|
||||
$currencyId = Session::get(SESSION_CURRENCY);
|
||||
}
|
||||
|
||||
$currency = Currency::remember(DEFAULT_QUERY_CACHE)->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);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var currencies = {{ \Cache::pull('currency') }};
|
||||
var currencies = {!! \Cache::pull('currency') !!};
|
||||
var currencyMap = {};
|
||||
for (var i=0; i<currencies.length; i++) {
|
||||
var currency = currencies[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user