public function getTotalCountries($where) { $var_cache = 'total' . ucfirst($where) . 'FacebookCountries'; if (!Cache::has($var_cache)) { switch ($where) { case 'world': $data['total'] = FacebookCountry::count(); break; case 'hispanic': $data['total'] = FacebookCountry::whereIdiom('es')->count(); break; default: return 'Invalid method'; } Cache::put($var_cache, $data, 1440); } return Cache::get($var_cache); }
private function getTotalCountries() { if (!Cache::has('totalCountries')) { $data = FacebookCountry::count(); Cache::put('totalCountries', $data, 1440); } return Cache::get('totalCountries'); }