id(); $table->timestamps(); $table->integer('site_id')->unsigned(); $table->boolean('active')->default(false); $table->dateTime('start_at')->nullable(); $table->dateTime('expire_at')->nullable(); $table->integer('account_id')->unsigned(); $table->foreign(['account_id','site_id'])->references(['id','site_id'])->on('accounts'); $table->integer('group_id')->unsigned(); $table->foreign(['group_id','site_id'])->references(['id','site_id'])->on('groups'); $table->unique(['id','site_id']); $table->unique(['site_id','group_id','account_id']); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('account_group'); } };