```php increments('id'); $table->text('content'); $table->unsignedInteger('exam_id'); $table->foreign('exam_id')->references('id')->on('exams'); $table->unsignedInteger('user_id'); $table->foreign('user_id')->references('id')->on('users'); $table->unsignedTinyInteger('score'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tests'); } } ``` ``` 4. `content`:紀錄此測驗的題目編號及答案 5. `exam_id`:對應的測驗編號 6. `user_id`:學生編號 7. `score`:得分 8. 最後執行資料庫同步即可建出新的資料表 ```bash php artisan migrate ``` 9. 資料表: [](https://github.com/tad0616/exam56/commit/c6b2d79b5d2152891600d9f47a0800cfb454affe)
進階搜尋