I will go straight to that. This question is related to my past question , I will offer you a reward within 3 days if you solve this problem.
What I want
After the user answered the quiz, the user can save it without sending, so they can edit / continue later. Now, after they have been saved, how can I go through the user response in the current quiz cycle of questions? So that the user can edit or continue the quiz.
What i have
Database:
quiz_result_of_user has fields 9 , ['id', 'quiz_id', 'user_id', 'question_id', 'answer', 'question_type', 'attempt_number', 'marks', 'grades']
- This table saves all user responses, so it serves as a history table for the user quiz.
quizattempt_user has fields 3 , ['id', 'quiz_id', 'user_id']
- This table saves all user attempts, so I can refer to all user answers
where id = attempt_number in the quiz_result_of_user table. li>
Controller - Update
$quiz = Quiz::with('multiple_choices.answers', 'true_false', 'short_answer', 'descriptions')->findOrFail($id); $questions = collect($quiz->multiple_choices); $questions = $questions->merge(collect($quiz->true_false)); $questions = $questions->merge(collect($quiz->short_answer)); $questions = $questions->merge(collect($quiz->descriptions)); $questions = $questions->sortBy('question_number');
Problem
Now I can ask the questions and answers of the user, but I canβt understand how I can answer the user, because it is also a data set. Note. Each survey can have different types of questions, multiple choice , true or false and short answer/fill in the blank .
Jonjie
source share