public function getRankingProfileGrow() { $var_cache = 'rankingInstagramGrow'; if (!Cache::has($var_cache)) { $ranking = InstagramProfile::take(4)->orderBy('followed_by_grow_30', 'DESC'); $ranking = $ranking->get(['username', 'name', 'picture', 'followed_by_count', 'followed_by_grow_30']); $profiles = array(); foreach ($ranking as $key => $value) { $cache = NULL; $cache['username'] = strtolower($value['username']); $cache['name'] = $value['name']; $cache['picture'] = $value['picture']; $cache['percent'] = 0; if ($value['followed_by_count'] - $value['followed_by_grow_30'] > 0) { $cache['percent'] = $this->owlooFormatPorcent($value['followed_by_grow_30'], $value['followed_by_count'] - $value['followed_by_grow_30']); } $cache['grow_30'] = $this->owloo_number_format($value['followed_by_grow_30']); $profiles[] = $cache; } Cache::put($var_cache, $profiles, 1440); } return Cache::get($var_cache); }
public function getLastProfileAdded($limit = 4) { $var_cache = 'lastInstagramProfileAdded' . $limit; if (!Cache::has($var_cache)) { $ranking = InstagramProfile::take($limit)->orderBy('id', 'DESC'); $ranking = $ranking->get(['username', 'name', 'picture']); $profiles = array(); foreach ($ranking as $key => $value) { $cache = NULL; $cache['username'] = strtolower($value['username']); $cache['name'] = !empty($value['name']) ? $value['name'] : $value['username']; $cache['picture'] = $value['picture']; $profiles[] = $cache; } Cache::put($var_cache, $profiles, 1440); } return Cache::get($var_cache); }