/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(QuestionRequest $request, $id, $subjectId, $questionId) { $question = Question::findOrFail($questionId); $answer = Answer::where('question_id', $question->id); $myanswer = $request['answer']; $myanswer = $request[$myanswer]; $question->update($request->all()); $answer->update(['question_id' => $questionId, 'answer' => $myanswer]); return redirect()->route("classes.subjects.questions.index", [$id, $subjectId])->with('message', '<p class="alert alert-success">Question Updated</p>'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, QuestionRequest $request) { $question = Question::find($id); $question->update($request->all()); return redirect()->route('admin.questions.index')->with('message', '<p class="alert alert-success">Question Updated</p>'); }