uid = $uid; } public function transform(Post $post) { return [ 'id' => $post['id'], 'type' => $post['type'], 'uid' => $post['uid'], 'username' => subtext($post['username'], 10), 'avatar' => $post['avatar'], 'title' => $post['title'], 'img' => $post['img'], 'praise_count' => $post->data->praise_count, 'is_like' => PostLike::where('post_id', $post['id'])->where('uid', $this->uid)->exists()?1:0, ]; } }