欢迎各位兄弟 发布技术文章
这里的技术是共享的
<?php
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateArticleArticleTypeTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('article_article_type', function (Blueprint $table) { $table->integer('article_id')->unsigned();; $table->integer('article_type_id')->unsigned();; $table->foreign('article_id')->references('article_id')->on('articles')->onDelete('cascade'); $table->foreign('article_type_id')->references('article_type_id')->on('article_types')->onDelete('cascade'); $table->primary(['article_id','article_type_id']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('article_article_type'); } }