Add grade/Klasse system: assign class levels to users, questions, and quizzes

- users.grade: set per child in admin (Klasse 1–10)
- quizzes.grade, questions.grade: optional target class (null = all)
- Children only see content matching their grade or without grade set
- Admin views show grade badge in user list, quiz list, questions list
- Quiz create/edit and user create/edit have Klasse dropdown
This commit is contained in:
root
2026-05-06 07:19:17 +00:00
parent c66f126e99
commit 44f281514b
13 changed files with 85 additions and 9 deletions
@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void {
Schema::table('users', fn(Blueprint $t) => $t->unsignedTinyInteger('grade')->nullable()->after('role'));
Schema::table('quizzes', fn(Blueprint $t) => $t->unsignedTinyInteger('grade')->nullable()->after('active'));
Schema::table('questions', fn(Blueprint $t) => $t->unsignedTinyInteger('grade')->nullable()->after('active'));
}
public function down(): void {
Schema::table('users', fn(Blueprint $t) => $t->dropColumn('grade'));
Schema::table('quizzes', fn(Blueprint $t) => $t->dropColumn('grade'));
Schema::table('questions', fn(Blueprint $t) => $t->dropColumn('grade'));
}
};