forked from mirror/pixelfed
Add API Search ResultsTransformer
This commit is contained in:
parent
ba8c101703
commit
84960d701c
|
@ -8,12 +8,12 @@ class ResultsTransformer extends Fractal\TransformerAbstract
|
|||
{
|
||||
|
||||
protected $defaultIncludes = [
|
||||
'account',
|
||||
'mentions',
|
||||
'media_attachments',
|
||||
'tags',
|
||||
'accounts',
|
||||
'statuses',
|
||||
'hashtags',
|
||||
];
|
||||
public function transform()
|
||||
|
||||
public function transform($results)
|
||||
{
|
||||
return [
|
||||
'accounts' => [],
|
||||
|
@ -21,4 +21,22 @@ class ResultsTransformer extends Fractal\TransformerAbstract
|
|||
'hashtags' => []
|
||||
];
|
||||
}
|
||||
|
||||
public function includeAccounts($results)
|
||||
{
|
||||
$accounts = $results->accounts;
|
||||
return $this->collection($accounts, new AccountTransformer());
|
||||
}
|
||||
|
||||
public function includeStatuses($results)
|
||||
{
|
||||
$statuses = $results->statuses;
|
||||
return $this->collection($statuses, new StatusTransformer());
|
||||
}
|
||||
|
||||
public function includeTags($results)
|
||||
{
|
||||
$hashtags = $status->hashtags;
|
||||
return $this->collection($hashtags, new HashtagTransformer());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue