Update PublicApiController

This commit is contained in:
Daniel Supernault 2018-11-17 12:58:58 -07:00
parent 3e4910e3df
commit b1e9cd0972
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -50,10 +50,15 @@ class PublicApiController extends Controller
{
$profile = Profile::whereUsername($username)->first();
$status = Status::whereProfileId($profile->id)->find($postid);
$status = new Fractal\Resource\Item($status, new StatusTransformer());
$item = new Fractal\Resource\Item($status, new StatusTransformer());
$res = [
'status' => $this->fractal->createData($status)->toArray(),
'user' => $this->getUserData()
'status' => $this->fractal->createData($item)->toArray(),
'user' => $this->getUserData(),
'reactions' => [
'liked' => $status->liked(),
'shared' => $status->shared(),
'bookmarked' => $status->bookmarked(),
],
];
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}