- Your answer
- @if($state === 'skip')No answer given@else{{ $opts[$r['given']]['text'] ?? $r['given'] }}@endif @if($state !== 'ok')
- Correct answer
- {{ $opts[$q->correct_key]['text'] ?? $q->correct_key }} @endif
Why: {{ $q->explanation }}
@endif@extends('layouts.portal')
@php
$letters = fn ($opts) => collect($opts)->map(function ($o, $i) {
if (is_array($o)) { return ['key' => (string) ($o['key'] ?? chr(65 + $i)), 'text' => (string) ($o['text'] ?? $o['label'] ?? '')]; }
return ['key' => is_int($i) ? chr(65 + $i) : (string) $i, 'text' => (string) $o];
})->values();
$review = session('quiz_review') ?: ($last?->answers ?? null);
$fresh = session()->has('quiz_review');
$passed = $last && $last->status === 'passed';
$qCount = $questions->count();
$courseModel = $quiz->course;
@endphp
@section('title', $quiz->title)
@section('subtitle', ($courseModel ? $courseModel->title.' · ' : '').$qCount.' questions · pass mark '.$quiz->pass_percent.'%')
@section('actions')
@if($courseModel)
{{ $fresh ? 'Just now' : 'Last attempt '.$last->submitted_at?->diffForHumans() }} · pass mark {{ $quiz->pass_percent }}%. @if($review){{ collect($review)->where('ok', true)->count() }} of {{ count($review) }} correct.@endif
Why: {{ $q->explanation }}
@endif