public function getTotalUser($who) { $who = strtolower($who); $var_cache = 'total' . ucfirst($who) . 'FacebookUserCountries'; if (!Cache::has($var_cache)) { switch ($who) { case 'all': $data['total'] = FacebookCountry::sum('total_user'); break; case 'women': $data['total'] = FacebookCountry::sum('total_female'); break; case 'men': $data['total'] = FacebookCountry::sum('total_male'); break; case 'grow': $total_user = FacebookCountry::sum('total_user'); $audience_grow_90 = FacebookCountry::sum('audience_grow_90'); $data['grow'] = $this->formatGrow($audience_grow_90, $total_user); break; default: return 'Invalid method'; } if ($who != 'grow') { $data['total'] = $this->owloo_number_format($data['total']); } Cache::put($var_cache, $data, 1440); } return Cache::get($var_cache); }
public function getTotalUser($who) { $var_cache = 'total' . ucfirst($who) . 'FacebookUserCountries'; if (!Cache::has($var_cache)) { switch ($who) { case 'all': $data['total'] = FacebookCountry::sum('total_user'); break; case 'women': $data['total'] = FacebookCountry::sum('total_female'); break; case 'men': $data['total'] = FacebookCountry::sum('total_male'); break; default: return 'Invalid method'; } $data['total'] = $this->owloo_number_format($data['total']); Cache::put($var_cache, $data, 1440); } return Cache::get($var_cache); }