public function getRegionCountries() { $var_cache = 'listCountriesRegions'; if (!Cache::has($var_cache)) { $countries = FacebookCountry::whereSupportsRegion('1')->orderBy('name', 'ASC')->get(['id_country', 'name', 'slug', 'code', 'abbreviation']); $cache = array(); foreach ($countries as $value) { $index = $value['slug']; $cache[$index]['id'] = $value['id_country']; $cache[$index]['code'] = $value['code']; $cache[$index]['name'] = $value['name']; $cache[$index]['abbreviation'] = $value['abbreviation']; } Cache::put($var_cache, $cache, 1440); } return Cache::get($var_cache); }