Update StatusTransformer, fix missing tags attribute

pull/2761/head
Daniel Supernault 4 years ago
parent 955696b8a0
commit dac326e949
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -15,6 +15,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
'account',
'tags',
'media_attachments',
];
@ -72,6 +73,13 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
return $this->item($account, new AccountTransformer());
}
public function includeTags(Status $status)
{
$tags = $status->hashtags;
return $this->collection($tags, new HashtagTransformer());
}
public function includeMediaAttachments(Status $status)
{
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) {

@ -17,6 +17,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
'account',
'tags',
'media_attachments',
];
@ -74,6 +75,13 @@ class StatusTransformer extends Fractal\TransformerAbstract
return $this->item($account, new AccountTransformer());
}
public function includeTags(Status $status)
{
$tags = $status->hashtags;
return $this->collection($tags, new HashtagTransformer());
}
public function includeMediaAttachments(Status $status)
{
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(14), function() use($status) {

Loading…
Cancel
Save