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:
@@ -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'));
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user