1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-26 01:36:43 +00:00

Update InternalApiController, add bookmarks api

This commit is contained in:
Daniel Supernault 2019-07-12 21:22:53 -06:00
parent e288b45c5b
commit 4c1d35cfa2
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -306,4 +306,18 @@ class InternalApiController extends Controller
Cache::forget('profile:status_count:'.$profile->id); Cache::forget('profile:status_count:'.$profile->id);
return $status->url(); return $status->url();
} }
public function bookmarks(Request $request)
{
$statuses = Auth::user()->profile
->bookmarks()
->withCount(['likes','comments'])
->orderBy('created_at', 'desc')
->simplePaginate(10);
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
return response()->json($res);
}
} }