Exemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(QuestionValidatedRequest $request)
 {
     $data = $request->all();
     try {
         $data['user_id'] = Auth::user()->id;
         $question = $this->questionService->createQuestion($data);
     } catch (QuestionServiceException $e) {
         return Response::json(['all' => $e->getMessage()], 400);
     }
     return Response::json($question->toArray(), 200, [], JSON_NUMERIC_CHECK);
 }