@if(!$q)

Question Not Found

The requested quiz question could not be found or has been deleted.

@else

{{ $q->quiz_name }}

Time Limit
@php if ($q->time_limit < 60) { echo $q->time_limit . ' seconds'; } else { $minutes = floor($q->time_limit / 60); $seconds = $q->time_limit % 60; echo $minutes . ':' . str_pad($seconds, 2, '0', STR_PAD_LEFT) . ' minutes'; } @endphp
Type
{{ ucfirst(str_replace('_', ' ', $q->question_type)) }}

Question

{{ $q->question }}
@if($q->question_image)

Media

Question image uploaded

@endif

Options

@if($q->question_type == 'quiz')
@for($i = 1; $i <= 4; $i++) @if(!empty($q->{'option_' . $i})) @php $colors = ['#FF6B6B', '#4ECDC4', '#FFD166', '#06D6A0']; $bgColor = $q->{'color_' . $i} ?? $colors[$i-1]; // Check if this option is correct $isCorrect = false; $correctAnswers = json_decode($q->correct_answer, true); if (is_array($correctAnswers)) { $isCorrect = in_array($i, $correctAnswers); } else { $isCorrect = $q->correct_answer == $i; } @endphp
{{ chr(64 + $i) }}
Option {{ $i }}
{{ $q->{'option_' . $i} }}
@if($isCorrect)
Correct
@endif
@endif @endfor
@else
@php $isTrueCorrect = $q->correct_answer == 'true'; $isFalseCorrect = $q->correct_answer == 'false'; @endphp
TRUE
@if($isTrueCorrect)
Correct
@endif
FALSE
@if($isFalseCorrect)
Correct
@endif
@endif

Correct Answer

The correct answer is:
@if($q->question_type == 'quiz') @php $correctAnswers = json_decode($q->correct_answer, true); if (is_array($correctAnswers)) { // Multiple correct answers $answerTexts = []; foreach ($correctAnswers as $answer) { if (!empty($q->{'option_' . $answer})) { $answerTexts[] = "Option " . $answer . ": " . $q->{'option_' . $answer}; } } echo implode('
', $answerTexts); } else { // Single correct answer echo "Option " . $q->correct_answer; if (!empty($q->{'option_' . $q->correct_answer})) { echo ': ' . $q->{'option_' . $q->correct_answer}; } } @endphp @else {{ ucfirst($q->correct_answer) }} @endif
@endif