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);
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);
}
}