content = $request->get('content'); $reply->topic_id = $topic->id; $reply->user_id = $this->user()->id; $reply->save(); return $this->response->item($reply, new ReplyTransformer())->setStatusCode(201); } /** * @param Reply $reply * @return \Dingo\Api\Http\Response * @throws \Illuminate\Auth\Access\AuthorizationException * @throws \Throwable */ public function destroy(Reply $reply) { $this->authorize('destroy', $reply); $reply->delete(); return $this->response->noContent(); } /** * @param Topic $topic * @return \Dingo\Api\Http\Response */ public function index(Topic $topic) { $replies = $topic->replies()->recent()->paginate(20); return $this->response->paginator($replies, new ReplyTransformer()); } public function userIndex(User $user) { $replies = $user->replies()->recent()->paginate(20); return $this->response->paginator($replies, new ReplyTransformer()); } }