Browse Source

Update PublicApiController

Daniel Supernault 6 years ago
parent
commit
b1e9cd0972
1 changed files with 8 additions and 3 deletions
  1. 8 3
      app/Http/Controllers/PublicApiController.php

+ 8 - 3
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);
     }