Skip to content

Instantly share code, notes, and snippets.

@Cerwyn
Last active April 16, 2020 06:51
Show Gist options
  • Save Cerwyn/2ee0d82c90c6c2fa24b21736ed2548b8 to your computer and use it in GitHub Desktop.
Save Cerwyn/2ee0d82c90c6c2fa24b21736ed2548b8 to your computer and use it in GitHub Desktop.
One-to-many
<?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