@php
$answered_questions = App\Models\QuizAnswer::select('questions.id','questions.question','quiz_answers.answer','one_word_answers.answer as correct_answer','quiz_answers.is_correct')
->join('questions','quiz_answers.question_id','questions.id')
->join('one_word_answers','one_word_answers.question_id','questions.id')
->where('quiz_answers.student_id',STUDENT_ID)
->where('quiz_answers.unit_id',$unit_id)
->where('quiz_answers.task_id',$quiz_id)
->where('quiz_answers.attempt',$attempt)
->groupBy('questions.id')
->get();
@endphp
@foreach($answered_questions as $key=>$quizanwers)
@php
$ans = explode(',',$quizanwers->correct_answer);
$color = $quizanwers->is_correct?'green':'red';
@endphp
@php
$q_count++;
@endphp
@endforeach
@php
$multiple_answered_questions = App\Models\QuizAnswer::select('questions.id','questions.question','quiz_answers.answer','multiple_options.option as correct_answer','quiz_answers.is_correct')
->join('questions','quiz_answers.question_id','questions.id')
->join('multiple_options', function ($join) {
$join->on('multiple_options.question_id', '=', 'questions.id')
->where('multiple_options.is_answer', '=', 1);
})
->where('quiz_answers.student_id',STUDENT_ID)
->where('quiz_answers.unit_id',$unit_id)
->where('quiz_answers.task_id',$quiz_id)
->where('quiz_answers.attempt',$attempt)
->groupBy('questions.id')
->get();
@endphp
@foreach($multiple_answered_questions as $key=>$quizanwers)
@php
$ans = $quizanwers->correct_answer;
$color = $quizanwers->is_correct?'green':'red';
@endphp
@php
$q_count++;
@endphp
@endforeach