<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCmsPagesTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('cms_pages', function (Blueprint $table) {
            $table->id();
            $table->string('slug')->index()->nullable()->comment('唯一的别名');
            $table->string('title');
            $table->string('sub_title')->nullable()->comment('副标题');
            $table->string('description')->nullable();
            $table->string('cover')->nullable();
            $table->json('pictures')->nullable();
            $table->text('content');
            $table->json('attachments')->nullable();
            $table->boolean('status')->default(0);
            $table->unsignedInteger('clicks')->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

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

}
