|
@@ -35,21 +35,12 @@ class SuggestTransformer extends TransformerAbstract
|
|
|
$comments = PostComment::where('post_id', $post['id'])->where('parent_id', 0)->orderBy('id', 'desc')->limit(2)->get();
|
|
|
foreach($comments as $item){
|
|
|
$replyCount = $item->reply->count();
|
|
|
- $replies = PostComment::where('parent_id', $item->id)->orderBy('id', 'desc')->limit(2)->get();
|
|
|
- $reply = [];
|
|
|
- foreach($replies as $val){
|
|
|
- $reply[] = [
|
|
|
- 'username' => subtext($val->username, 10),
|
|
|
- 'reply_username' => subtext($val->reply_username, 10),
|
|
|
- 'content' => $val->content,
|
|
|
- ];
|
|
|
- }
|
|
|
$comment[] = [
|
|
|
'id' => $item->id,
|
|
|
'username' => subtext($item->username, 10),
|
|
|
'content' => $item->content,
|
|
|
'reply_count' => $replyCount,
|
|
|
- 'reply' => $reply,
|
|
|
+ 'reply' => [],
|
|
|
];
|
|
|
}
|
|
|
$topic = [];
|