function currency_converted($total) { /* $currency_selected = Keywords::find(5); $currency_sel = $currency_selected->keyword; */ $currency_sel = Config::get('app.generic_keywords.Currency'); if ($currency_sel == '$') { $currency_sel = "USD"; } else { $currency_sel = Config::get('app.generic_keywords.Currency'); } if ($currency_sel != 'USD') { $check = check_cache($currency_sel); if (!$check) { $url = "http://currency-api.appspot.com/api/USD/" . $currency_sel . ".json?key=65d69f1a909b37e41272574dcd20c30fb2fbb06e"; $result = file_get_contents($url); $result = json_decode($result); $rate = $result->rate; update_cache($currency_sel, $rate); $total = $total * $rate; } else { $rate = Cash::where('key', 'like', '%' . $currency_sel . '%')->first(); $total = $total * $rate->value; } } else { $total = $total; } return $total; }