public function up() {
Schema::create('orders', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('seller_id');
$table->foreign('seller_id')->references('id')->on('sellers')->onDelete('cascade');
$table->decimal('total',8,2);
$table->decimal('discount',8,2)->default(0);
$table->decimal('tax',8,2);
$table->boolean('paid')->default(0);
$table->timestamps();
});
}
sellers table
public function up() {
Schema::create('sellers', function (Blueprint $table) {
$table->increments('id');
$table->string('CompanyName');
$table->string('SellerName');
$table->string('email')->unique();
$table->string('password');
$table->bigInteger('contact');
$table->mediumText('officeAddress');
$table->string('city');
$table->string('state');
$table->rememberToken();
$table->timestamps();
});
}
I tried all possible ways to define foreign key but couldn't get success please help me out enter image description here