From e08f64600887a203d4c4fcebdbf49d1b17a7641f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 21 Nov 2020 18:58:08 -0700 Subject: [PATCH] Update DiscoverController --- app/Http/Controllers/DiscoverController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/DiscoverController.php b/app/Http/Controllers/DiscoverController.php index b6effedb..113239cf 100644 --- a/app/Http/Controllers/DiscoverController.php +++ b/app/Http/Controllers/DiscoverController.php @@ -181,11 +181,13 @@ class DiscoverController extends Controller $ttl = now()->addHours(2); $res = Cache::remember($key, $ttl, function() use($range) { if($range == '-1') { - $res = Status::orderBy('likes_count','desc') + $res = Status::whereVisibility('public') + ->orderBy('likes_count','desc') ->take(12) ->get(); } else { - $res = Status::orderBy('likes_count','desc') + $res = Status::whereVisibility('public') + ->orderBy('likes_count','desc') ->take(12) ->where('created_at', '>', now()->subDays($range)) ->get();