|
@@ -9,11 +9,13 @@
|
|
|
namespace App\Transformers\Post;
|
|
|
|
|
|
use App\Models\Post;
|
|
|
+use App\Traits\PostTrait;
|
|
|
use Illuminate\Support\Carbon;
|
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
|
|
class PostTransformer extends TransformerAbstract
|
|
|
{
|
|
|
+ use PostTrait;
|
|
|
public function transform(Post $post)
|
|
|
{
|
|
|
return [
|
|
@@ -22,7 +24,7 @@ class PostTransformer extends TransformerAbstract
|
|
|
'uid' => $post['uid'],
|
|
|
'username' => $post['username'],
|
|
|
'avatar' => $post['avatar'],
|
|
|
- 'topic' => $post->topic(),
|
|
|
+ 'topic' => $this->getTopic($post['topic_ids']),
|
|
|
'content' => subtext(strip_tags($post['content']), 20),
|
|
|
'location' => $post['location'],
|
|
|
'pv' => $post->data->pv_real.'/'.$post->data->pv,
|