Last active
April 16, 2020 06:51
-
-
Save Cerwyn/2ee0d82c90c6c2fa24b21736ed2548b8 to your computer and use it in GitHub Desktop.
One-to-many
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 | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateArticlesTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('articles', function (Blueprint $table) { | |
$table->bigIncrements('id'); | |
$table->bigInteger('best_comment_id')->nullable(); | |
$table->string('title'); | |
$table->string('slug'); | |
$table->string('body'); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('articles'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment