From b1e9cd0972bffd85535b116aa3c1f6f3f4a23d42 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 17 Nov 2018 12:58:58 -0700 Subject: [PATCH] Update PublicApiController --- app/Http/Controllers/PublicApiController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/PublicApiController.php b/app/Http/Controllers/PublicApiController.php index 7c28fa3a4..c28ad1283 100644 --- a/app/Http/Controllers/PublicApiController.php +++ b/app/Http/Controllers/PublicApiController.php @@ -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); }