public function getCountries() { if (!Cache::has('listCountries')) { $countries = FacebookCountry::orderBy('name', 'ASC')->get(['id_country', 'name', 'code', 'abbreviation']); $cache = array(); foreach ($countries as $value) { $cache[strtolower($value['code'])]['id'] = $value['id_country']; $cache[strtolower($value['code'])]['name'] = $value['name']; $cache[strtolower($value['code'])]['abbreviation'] = $value['abbreviation']; } Cache::put('listCountries', $cache, 1440); } return Cache::get('listCountries'); }