Update DiscoverController

This commit is contained in:
Daniel Supernault 2020-11-21 18:58:08 -07:00
parent ad527eb705
commit e08f646008
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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();