public function getTotalProfile() { if (!Cache::has('totalInstagramProfiles')) { $data['total'] = InstagramProfile::count(); Cache::put('totalInstagramProfiles', $data, 1440); } return Cache::get('totalInstagramProfiles'); }
public function getTotalProfile($category = 'all') { if (!Cache::has('total' . ucfirst($category) . 'InstagramProfiles')) { $is_have_category = false; $id_category = NULL; if ($category != 'all') { $category_search = InstagramCategory::whereCategory($category)->first(); if ($category_search) { $id_category = $category_search->id_category; $is_have_category = true; } else { return 'Invalid method'; } } if ($is_have_category) { $data['total'] = InstagramProfile::whereCategory($category)->count(); } else { $data['total'] = InstagramProfile::count(); } Cache::put('totalInstagramProfiles', $data, 1440); } return Cache::get('totalInstagramProfiles'); }