This commit is contained in:
2021-05-23 03:31:21 +05:00
parent 25cbe852de
commit 49d26adb58
2 changed files with 5 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ class HomeController extends Controller
*/ */
public function __invoke(Request $request) public function __invoke(Request $request)
{ {
$todays_pick = Cache::store('redis')->remember('home.todayspick', 600, function () { $todays_pick = Cache::remember('home.todayspick', 600, function () {
return Article::with('topics', 'source') return Article::with('topics', 'source')
->whereDate('published_date', Carbon::today()) ->whereDate('published_date', Carbon::today())
->inRandomOrder() ->inRandomOrder()
@@ -40,21 +40,21 @@ class HomeController extends Controller
}); });
$covid19 = config("karudhaas.topic_filters.covid19"); $covid19 = config("karudhaas.topic_filters.covid19");
$covid19_articles = Cache::store('redis')->remember("home.articles.covid19", 600, function () use ($covid19) { $covid19_articles = Cache::remember("home.articles.covid19", 600, function () use ($covid19) {
return Article::with('source')->whereHas('topics', function ($q) use ($covid19) { return Article::with('source')->whereHas('topics', function ($q) use ($covid19) {
$q->whereIn('slug', $covid19["keys"]); $q->whereIn('slug', $covid19["keys"]);
})->latest('published_date')->limit(5)->get(); })->latest('published_date')->limit(5)->get();
}); });
$business = config("karudhaas.topic_filters.business"); $business = config("karudhaas.topic_filters.business");
$business_articles = Cache::store('redis')->remember("home.articles.business", 600, function () use ($business) { $business_articles = Cache::remember("home.articles.business", 600, function () use ($business) {
return Article::with('source')->whereHas('topics', function ($q) use ($business) { return Article::with('source')->whereHas('topics', function ($q) use ($business) {
$q->whereIn('slug', $business["keys"]); $q->whereIn('slug', $business["keys"]);
})->latest('published_date')->limit(4)->get(); })->latest('published_date')->limit(4)->get();
}); });
$sports = config("karudhaas.topic_filters.sports"); $sports = config("karudhaas.topic_filters.sports");
$sports_articles = Cache::store('redis')->remember("home.articles.sports", 600, function () use ($sports) { $sports_articles = Cache::remember("home.articles.sports", 600, function () use ($sports) {
return Article::with('source')->whereHas('topics', function ($q) use ($sports) { return Article::with('source')->whereHas('topics', function ($q) use ($sports) {
$q->whereIn('slug',$sports["keys"]); $q->whereIn('slug',$sports["keys"]);
})->latest('published_date')->limit(4)->get(); })->latest('published_date')->limit(4)->get();

View File

@@ -19,7 +19,7 @@ class NameSpaceController extends Controller
$options = config("karudhaas.topic_filters." . $namespace); $options = config("karudhaas.topic_filters." . $namespace);
$articles = Cache::store('redis')->remember("articles.$namespace", 600, function () use ($options) { $articles = Cache::remember("articles.$namespace", 600, function () use ($options) {
return Article::with('source')->whereHas('topics', function ($q) use ($options) { return Article::with('source')->whereHas('topics', function ($q) use ($options) {
$q->whereIn('slug', $options["keys"]); $q->whereIn('slug', $options["keys"]);
})->latest('published_date')->limit(8)->get(); })->latest('published_date')->limit(8)->get();