id(); $table->string('title'); $table->string('description'); $table->timestamp('closed_at')->nullable(); $table->unsignedBigInteger('category_id')->nullable(); $table->unsignedBigInteger('author_id')->nullable(); $table->foreign('author_id')->references('id')->on('users')->onDelete('set null'); $table->foreign('category_id')->references('id')->on('categories')->onDelete('set null'); $table->timestamps(); }); Schema::create('question_test', function (Blueprint $table) { $table->foreignId('test_id')->constrained()->cascadeOnDelete(); $table->foreignId('question_id')->constrained()->cascadeOnDelete(); $table->primary(['test_id', 'question_id']); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('tests'); } };