2018-12-31 04:26:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Transformer\Api;
|
|
|
|
|
|
|
|
use League\Fractal;
|
|
|
|
|
|
|
|
class ResultsTransformer extends Fractal\TransformerAbstract
|
|
|
|
{
|
|
|
|
|
|
|
|
protected $defaultIncludes = [
|
2019-01-12 20:58:35 +00:00
|
|
|
'accounts',
|
|
|
|
'statuses',
|
|
|
|
'hashtags',
|
2018-12-31 04:26:37 +00:00
|
|
|
];
|
2019-01-12 20:58:35 +00:00
|
|
|
|
|
|
|
public function transform($results)
|
2018-12-31 04:26:37 +00:00
|
|
|
{
|
|
|
|
return [
|
|
|
|
'accounts' => [],
|
|
|
|
'statuses' => [],
|
|
|
|
'hashtags' => []
|
|
|
|
];
|
|
|
|
}
|
2019-01-12 20:58:35 +00:00
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
2018-12-31 04:26:37 +00:00
|
|
|
}
|