Esempio n. 1
0
 public function update(CommentValidatedRequest $request, $entry_id, $comment_id)
 {
     try {
         $comment = $this->questionService->updateComment($request->all(), $comment_id);
     } catch (QuestionServiceException $e) {
         return Response::json(['error' => ['message' => $e->getMessage()]], 404);
     }
     return Response::json($comment->toArray(), 202, [], JSON_NUMERIC_CHECK);
 }
Esempio n. 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CommentValidatedRequest $request, $question_id)
 {
     try {
         $comment = $this->questionService->createComment($request->all(), $question_id);
     } catch (QuestionServiceException $e) {
         return Response::json(['error' => ['message' => $e->getMessage()]], 404);
     }
     return Response::json($comment->toArray(), 201);
 }