Ejemplo n.º 1
0
 public function getCategories()
 {
     $var_cache = 'listFacebookCategories';
     if (!Cache::has($var_cache)) {
         $ranking = FacebookCategory::orderBy('category', 'ASC')->get();
         $categories = array();
         foreach ($ranking as $key => $value) {
             $cache = NULL;
             $index = $value['category'];
             $cache['id'] = $value['id_category'];
             $cache['name'] = $value['category'];
             $categories[$index] = $cache;
         }
         Cache::put($var_cache, $categories, 1440);
     }
     return Cache::get($var_cache);
 }
Ejemplo n.º 2
0
 public function getCategories()
 {
     $var_cache = 'listFacebookCategories';
     //if (!Cache::has($var_cache)) {
     $ranking = FacebookCategory::orderBy('category', 'ASC')->get();
     $categories = array();
     foreach ($ranking as $key => $value) {
         $cache = NULL;
         $index = str_replace([' ', 'á', 'é', 'í', 'ó', 'ú'], ['-', 'a', 'e', 'i', 'o', 'u'], strtolower($value['category']));
         $cache['id'] = $value['id_category'];
         $cache['name'] = $value['category'];
         $categories[$index] = $cache;
     }
     Cache::put($var_cache, $categories, 1440);
     //}
     return Cache::get($var_cache);
 }
Ejemplo n.º 3
0
 public function getCategories()
 {
     Cache::flush();
     if (!Cache::has('listFacebookCategories0')) {
         $ranking = FacebookCategory::orderBy('category', 'ASC')->get();
         foreach ($ranking as $key => $value) {
             $cache = NULL;
             $cache['id_category'] = $value['id_category'];
             $cache['name'] = $value['category'];
             $cache['tag'] = str_replace([' ', 'á', 'é', 'í', 'ó', 'ú'], ['_', 'a', 'e', 'i', 'o', 'u'], strtolower($value['category']));
             $var = 'listFacebookCategories' . $key;
             Cache::put($var, $cache, 1440);
         }
     }
     $foo = array();
     $limit = $this->getTotalCategory();
     for ($i = 0; $i < $limit; $i++) {
         $var = 'listFacebookCategories' . $i;
         $foo[$i] = Cache::get($var);
     }
     return $foo;
 }