Skip to content

Instantly share code, notes, and snippets.

@brandongallardoa
Created April 22, 2018 16:46
Show Gist options
  • Select an option

  • Save brandongallardoa/7a35ac7120106d100dc4973cf30b41b8 to your computer and use it in GitHub Desktop.

Select an option

Save brandongallardoa/7a35ac7120106d100dc4973cf30b41b8 to your computer and use it in GitHub Desktop.
<?php
//... se omiten los namespaces por brevedad
class CreateFollowersTable extends Migration
{
public function up()
{
Schema::create('followers', function (Blueprint $table) {
$table->increments('id');
$table->integer('follower_id')->unsigned();
$table->foreign('follower_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
$table->timestamps();
});
}
//... Se omite el metodo down por brevedad
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment