Skip to content

Instantly share code, notes, and snippets.

@dadamssg
Last active August 29, 2015 13:56
Show Gist options
  • Save dadamssg/8949434 to your computer and use it in GitHub Desktop.
Save dadamssg/8949434 to your computer and use it in GitHub Desktop.
<?php
Schema::table('users', function ($table) {
});
Schema::table('posts', function ($table) {
$table->foreign('user_id')
->references('id')->on('users');
});
Schema::table('comments', function ($table) {
$table->foreign('post_id')
->references('id')->on('posts')
->onDelete('cascade');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment