Exemplo n.º 1
0
 function addQuestion(Request $request)
 {
     $question = new Question();
     $question->fill($request->all())->save();
     $text = new Text();
     $text->fill(['description' => $request->description, 'question_id' => $question->id]);
     $text->user_id = $request->user_id;
     $text->save();
     $questions = $this->reloadQuestions($request->product_id);
     return ['questions' => $questions];
 }
Exemplo n.º 2
0
 function questionNew(Request $request)
 {
     $text = new Text();
     $text->question_id = $request->question_id;
     $text->description = $request->description;
     $text->user_id = auth()->user()->id;
     $text->save();
     $question = $text->question()->firstOrFail();
     auth()->user()->role_id == 3 ? $question->isResponded = 1 : ($question->isResponded = 0);
     $question->save();
     return $this->showText($request);
 }