@@ 36-47 (lines=12) @@ | ||
33 | * |
|
34 | * @return \Illuminate\Http\Response |
|
35 | */ |
|
36 | public function indexByTopicId($topic_id) |
|
37 | { |
|
38 | $this->replies->addAvailableInclude('user', ['name', 'avatar']); |
|
39 | ||
40 | $data = $this->replies |
|
41 | ->byTopicId($topic_id) |
|
42 | ->autoWith() |
|
43 | ->autoWithRootColumns(['id', 'vote_count', 'created_at']) |
|
44 | ->paginate(per_page()); |
|
45 | ||
46 | return $this->response()->paginator($data, new ReplyTransformer()); |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * 获取指定用户的回复. |
|
@@ 56-67 (lines=12) @@ | ||
53 | * |
|
54 | * @return \Dingo\Api\Http\Response |
|
55 | */ |
|
56 | public function indexByUserId($user_id) |
|
57 | { |
|
58 | $this->replies->addAvailableInclude('user', ['name', 'avatar']); |
|
59 | ||
60 | $data = $this->replies |
|
61 | ->byUserId($user_id) |
|
62 | ->autoWith() |
|
63 | ->autoWithRootColumns(['id', 'vote_count']) |
|
64 | ->paginate(per_page()); |
|
65 | ||
66 | return $this->response()->paginator($data, new ReplyTransformer()); |
|
67 | } |
|
68 | ||
69 | /** |
|
70 | * 发布一条新回复. |