/** * Update the specified Comment in storage. * PUT/PATCH /comments/{id} * * @param int $id * @param Request $request * * @return Response */ public function update($id, Request $request) { $input = $request->all(); /** @var Comment $comment */ $comment = $this->commentRepository->apiFindOrFail($id); $result = $this->commentRepository->updateRich($input, $id); $comment = $comment->fresh(); return $this->sendResponse($comment->toArray(), "Comment updated successfully"); }
/** * Update the specified Comment in storage. * * @param int $id * @param UpdateCommentRequest $request * * @return Response */ public function update($id, UpdateCommentRequest $request) { $comment = $this->commentRepository->find($id); if (empty($comment)) { Flash::error('Comment not found'); return redirect(route('comments.index')); } $this->commentRepository->updateRich($request->all(), $id); Flash::success('Comment updated successfully.'); return redirect(route('comments.index')); }