1
0
Fork 0

Update StatusTransformer, remove unused fields

This commit is contained in:
Daniel Supernault 2019-08-17 23:40:25 -06:00
parent 0d350ea03e
commit 9b82f75183
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 3 additions and 17 deletions

View File

@ -10,9 +10,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
'account',
'mentions',
'media_attachments',
'tags',
];
public function transform(Status $status)
@ -41,13 +39,15 @@ class StatusTransformer extends Fractal\TransformerAbstract
],
'language' => null,
'pinned' => null,
'mentions' => [],
'tags' => [],
'pf_type' => $status->type ?? $status->setType(),
'reply_count' => (int) $status->reply_count,
'comments_disabled' => $status->comments_disabled ? true : false,
'thread' => false,
'replies' => [],
'parent' => [],
//'place' => $status->place
];
}
@ -58,13 +58,6 @@ class StatusTransformer extends Fractal\TransformerAbstract
return $this->item($account, new AccountTransformer());
}
public function includeMentions(Status $status)
{
$mentions = $status->mentions;
return $this->collection($mentions, new MentionTransformer());
}
public function includeMediaAttachments(Status $status)
{
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addDays(14), function() use($status) {
@ -74,11 +67,4 @@ class StatusTransformer extends Fractal\TransformerAbstract
}
});
}
public function includeTags(Status $status)
{
$tags = $status->hashtags;
return $this->collection($tags, new HashtagTransformer());
}
}