Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tghelere/82460cf64acd858a3bda92998565a3b9 to your computer and use it in GitHub Desktop.
Save tghelere/82460cf64acd858a3bda92998565a3b9 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeAttributeCategoryPostTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('category_post', function (Blueprint $table) {
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade')->change();
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade')->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment