Skip to content

Instantly share code, notes, and snippets.

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

  • Save brandongallardoa/3d917ca38d5d61d27a23b59b870040cf to your computer and use it in GitHub Desktop.

Select an option

Save brandongallardoa/3d917ca38d5d61d27a23b59b870040cf to your computer and use it in GitHub Desktop.
<?php
...
class CreatePostsTable extends Migration
{
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
$table->string('photo');
$table->string('description');
$table->timestamps();
});
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment