예제 #1
0
 public function show($topicName, $questionNumber)
 {
     $topic = Topic::where('name', '=', $topicName)->first();
     // may needs to be refactored, may check sql queries
     $question = Question::getByTopicAndQuestionNumber($topic, $questionNumber);
     $answers = $question->answers()->get();
     $nextQuestionLink = $question->nextQuestionLink($topic, $questionNumber);
     return view('quiz.show')->with(['questionNumber' => $questionNumber, 'topic' => $topic, 'question' => $question, 'answers' => $answers, 'next' => $nextQuestionLink]);
 }