Posts migration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Schema::create('posts', function (Blueprint $table) { | |
$table->id(); | |
$table->unsignedBigInteger('user_id'); | |
$table->foreign('user_id')->references('id')->on('users'); | |
//It can be done like this as well in a more simplified way | |
//$table->foreignId('user_id')->constrained(); | |
$table->timestamps(); | |
}); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment