/** * 所有帖子列表接口的通用部分. * * @return \Dingo\Api\Http\Response */ protected function commonIndex() { FilterManager::addFilter('newest'); $this->registerListApiIncludes(); $data = $this->topics->autoWith()->autoWithRootColumns(['id', 'title', 'is_excellent', 'reply_count', 'updated_at', 'created_at', 'vote_count'])->paginate(per_page()); return $this->response()->paginator($data, new TopicTransformer()); }
/** * 所有帖子列表接口的通用部分. * * @return \Dingo\Api\Http\Response */ protected function commonIndex() { $this->registerListApiIncludes(); $data = $this->repository->autoWith()->skipPresenter()->autoWithRootColumns(['id', 'title', 'is_excellent', 'reply_count', 'updated_at', 'created_at'])->paginate(per_page()); return $this->response()->paginator($data, new TopicTransformer()); }