Exemplo n.º 1
0
 public function getRankingContinent()
 {
     $var_cache = 'rankingContinents';
     if (!Cache::has($var_cache)) {
         $ranking = FacebookContinent::orderBy('total_user', 'DESC')->get(['name', 'total_user', 'total_female', 'total_male', 'grow_30']);
         $continents = array();
         foreach ($ranking as $key => $value) {
             $cache = NULL;
             $cache['position'] = $key + 1;
             $cache['name'] = $value['name'];
             $cache['total_user'] = $this->owloo_number_format($value['total_user']);
             $cache['total_female'] = array('value' => $this->owloo_number_format($value['total_female']), 'percent' => $this->owlooFormatPorcent($value['total_female'], $value['total_user']));
             $cache['total_male'] = array('value' => $this->owloo_number_format($value['total_male']), 'percent' => $this->owlooFormatPorcent($value['total_male'], $value['total_user']));
             $cache['grow_30'] = $this->formatGrow($value['grow_30'], $value['total_user']);
             $continents[] = $cache;
         }
         Cache::put($var_cache, $continents, 1440);
     }
     return Cache::get($var_cache);
 }
Exemplo n.º 2
0
 public function getRankingContinent()
 {
     $var_cache = 'rankingContinents';
     if (!Cache::has($var_cache)) {
         $ranking = FacebookContinent::orderBy('total_user', 'DESC')->get(['name', 'total_user', 'total_female', 'total_male', 'grow_30']);
         $continents = array();
         foreach ($ranking as $key => $value) {
             $cache = NULL;
             $cache['position'] = $key + 1;
             $cache['name'] = $value['name'];
             //Mes
             $aux_num = $this->formatGrow($value['grow_30'], $value['total_user']);
             $cache['second_column'][] = array('value' => $aux_num['value'], 'class' => $aux_num['class']);
             //Mujeres
             $cache['second_column'][] = array('value' => $this->owlooFormatPorcent($value['total_female'], $value['total_user']) . '%', 'class' => '');
             //Hombres
             $cache['second_column'][] = array('value' => $this->owlooFormatPorcent($value['total_male'], $value['total_user']) . '%', 'class' => '');
             //Total usuarios
             $cache['second_column'][] = array('value' => $this->owloo_number_format($value['total_user']), 'class' => '');
             $continents[] = $cache;
         }
         $second_column = array('Mes', 'Mujeres', 'Hombres', 'Total usuarios');
         $array_result = array('type' => 'fb_country', 'subtype' => 'fb_continent', 'main_column' => 'Continente', 'second_column' => $second_column, 'large_column' => 3, 'link' => NULL, 'items' => $continents);
         Cache::put($var_cache, $array_result, 1440);
     }
     return Cache::get($var_cache);
 }