Browse Source

Update StoryTransformer

Daniel Supernault 5 years ago
parent
commit
4c332ce700
1 changed files with 3 additions and 6 deletions
  1. 3 6
      app/Transformer/Api/StoryTransformer.php

+ 3 - 6
app/Transformer/Api/StoryTransformer.php

@@ -16,19 +16,16 @@ class StoryTransformer extends Fractal\TransformerAbstract
         return [
         return [
             'id'                        => (string) $story->id,
             'id'                        => (string) $story->id,
             'photo'                     => $story->profile->avatarUrl(),
             'photo'                     => $story->profile->avatarUrl(),
-            'name'                      => '',
-            'link'                      => '',
+            'name'                      => $story->profile->username,
+            'link'                      => $story->profile->url(),
             'lastUpdated'               => $story->updated_at->format('U'),
             'lastUpdated'               => $story->updated_at->format('U'),
             'seen'                      => $story->seen(),
             'seen'                      => $story->seen(),
-            'items'                     => [],
         ];
         ];
     }
     }
 
 
     public function includeItems(Story $story)
     public function includeItems(Story $story)
     {
     {
-        $items = $story->items;
-
-        return $this->collection($items, new StoryItemTransformer());
+        return $this->item($story, new StoryItemTransformer());
     }
     }
 
 
 }
 }