6c6dd26823
- Quizzes table with questions, answer options, attempts, answers - Question types: multiple_choice, exclusion, true_false, free_text - Progressive scoring: [1,1,2,2,3,3,4,6,8,10] = max 40 per quiz - Alpine.js countdown timer per question with auto-submit on timeout - Admin: CRUD for quizzes + per-question editor, JSON export/import - Child: quiz overview with best scores, question view, result breakdown - Nav: Quiz link in child header and admin sidebar
11 lines
480 B
PHP
11 lines
480 B
PHP
<?php
|
|
namespace App\Models;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
class Quiz extends Model {
|
|
protected $fillable = ['subject_id','title','description','active'];
|
|
protected $casts = ['active' => 'boolean'];
|
|
public function subject() { return $this->belongsTo(Subject::class); }
|
|
public function questions() { return $this->hasMany(QuizQuestion::class)->orderBy('sort_order'); }
|
|
public function attempts() { return $this->hasMany(QuizAttempt::class); }
|
|
}
|