|
@@ -16,7 +16,9 @@ class TopicTransformer extends TransformerAbstract{
|
|
{
|
|
{
|
|
$category = [];
|
|
$category = [];
|
|
foreach ($topic->ct as $key=>$value){
|
|
foreach ($topic->ct as $key=>$value){
|
|
- $category[] = $value->category;
|
|
+ if($key < 3){
|
|
|
|
+ $category[] = $value->category->name;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return [
|
|
return [
|
|
'id' => $topic['id'],
|
|
'id' => $topic['id'],
|
|
@@ -26,6 +28,9 @@ class TopicTransformer extends TransformerAbstract{
|
|
'is_hot' => $topic['is_hot'],
|
|
'is_hot' => $topic['is_hot'],
|
|
'is_open' => $topic['is_open'],
|
|
'is_open' => $topic['is_open'],
|
|
'desc' => $topic['desc'],
|
|
'desc' => $topic['desc'],
|
|
|
|
+ 'post_count' => 0,
|
|
|
|
+ 'follow_count' => 0,
|
|
|
|
+ 'page_count' => 0,
|
|
'created_at' => Carbon::parse($topic['created_at'])->toDateTimeString(),
|
|
'created_at' => Carbon::parse($topic['created_at'])->toDateTimeString(),
|
|
'category_list'=>$category,
|
|
'category_list'=>$category,
|
|
];
|
|
];
|