/** * 指定帖子下评论列表的 Web View. * * @param $topic_id * * @return \Illuminate\View\View */ public function indexWebViewByTopic($topic_id) { $replies = $this->replies->byTopicId($topic_id)->withOnly('user', ['id', 'name', 'avatar'])->all(['id', 'body', 'created_at', 'user_id']); // 楼层计数 $count = 1; return view('api_web_views.replies_list', compact('replies', 'count')); }
/** * Display a listing of the replies by topic id. * * @param $topic_id * * @return \Illuminate\Http\Response */ public function indexByTopicId($topic_id) { $this->repository->addAvailableInclude('user', ['name', 'avatar']); $data = $this->repository->byTopicId($topic_id)->skipPresenter()->autoWith()->autoWithRootColumns(['id', 'vote_count', 'created_at'])->paginate(per_page()); return $this->response()->paginator($data, new ReplyTransformer()); }