1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 08:14:10 +00:00

Update DiscoverController

This commit is contained in:
Daniel Supernault 2021-01-17 22:02:27 -07:00
parent 234f72f3aa
commit a98b65bf5c
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -144,12 +144,12 @@ class DiscoverController extends Controller
public function profilesDirectoryApi(Request $request) public function profilesDirectoryApi(Request $request)
{ {
return ['error' => 'Temporarily unavailable.'];
$this->validate($request, [ $this->validate($request, [
'page' => 'integer|max:10' 'page' => 'integer|max:10'
]); ]);
return ['error' => 'Temporarily unavailable.'];
$page = $request->input('page') ?? 1; $page = $request->input('page') ?? 1;
$key = 'discover:profiles:page:' . $page; $key = 'discover:profiles:page:' . $page;
$ttl = now()->addHours(12); $ttl = now()->addHours(12);
@ -214,6 +214,8 @@ class DiscoverController extends Controller
public function trendingHashtags(Request $request) public function trendingHashtags(Request $request)
{ {
return [];
$res = StatusHashtag::select('hashtag_id', \DB::raw('count(*) as total')) $res = StatusHashtag::select('hashtag_id', \DB::raw('count(*) as total'))
->groupBy('hashtag_id') ->groupBy('hashtag_id')
->orderBy('total','desc') ->orderBy('total','desc')
@ -234,6 +236,8 @@ class DiscoverController extends Controller
public function trendingPlaces(Request $request) public function trendingPlaces(Request $request)
{ {
return [];
$res = Status::select('place_id',DB::raw('count(place_id) as total')) $res = Status::select('place_id',DB::raw('count(place_id) as total'))
->whereNotNull('place_id') ->whereNotNull('place_id')
->where('created_at','>',now()->subDays(14)) ->where('created_at','>',now()->subDays(14))
@ -250,6 +254,6 @@ class DiscoverController extends Controller
]; ];
}); });
return $res; return [];
} }
} }