@extends('layouts.app') @section('title', '自建考試') @section('content')

自建考試

從公開題庫選擇題目,組成您的專屬練習

已選 0

第一步:命名您的練習考試

建立後會出現在「我的練習」中

@php $subjectMapJson = collect($catSubjectMap)->map(function ($subjects) { return collect($subjects)->map(fn($name, $id) => ['id' => $id, 'name' => $name])->values(); }); @endphp

第二步:選擇考試分類與考科

@if(request('category_id') || request('subject_id')) 重選 @endif
@if(request('category_id'))
目前顯示:{{ $categoryOptions[collect($categoryOptions)->search(fn($o) => $o['id'] == request('category_id'))]['name'] ?? '' }} @if(request('subject_id')) → {{ $questions->first()?->exam?->subject?->name ?? '' }} @else (所有考科) @endif 的題目
@endif

第三步:篩選題目(可選)

@if(request('category_id'))@endif @if(request('subject_id'))@endif
@if(request('search') || request('type') || request('difficulty')) 清除篩選 @endif
@include('components.pagination-bar', ['paginator' => $questions])
{{-- Group by exam for quick select --}} @php $examGroups = $questions->groupBy(fn($q) => $q->exam_id); @endphp @if($examGroups->count() > 1) | 按考試選取: @foreach($examGroups as $examId => $group) @php $examTitle = $group->first()->exam->title ?? '未知'; @endphp @endforeach @endif
@forelse($questions as $q)

{{ Str::limit($q->question_text, 150) }}

{{ match($q->question_type) { 'multiple_choice' => '選擇題', 'true_false' => '是非題', 'fill_blank' => '填充題', 'essay' => '問答題', default => '簡答題' } }} {{ match($q->difficulty) { 1 => '簡單', 3 => '困難', default => '中等' } }} @if($q->exam && $q->exam->subject) {{ $q->exam->subject->name }} @endif 來源:{{ $q->exam->title ?? '未知' }}
@empty

沒有符合條件的公開題目

@endforelse
@include('components.pagination-bar', ['paginator' => $questions])
@csrf
考試名稱:
已選
@endsection