<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pages', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->nullable();
            $table->foreign('user_id')->references('id')->on("users")->onDelete('cascade');
            $table->string('title')->nullable();
            $table->string('title_en')->nullable();
            $table->string('slug')->unique()->index();
            $table->string('image')->nullable();
            $table->longText('description')->nullable();
            $table->text('meta_description')->nullable();
            $table->json('content')->nullable();
            $table->tinyInteger('removable')->default(1);
            $table->tinyInteger('home')->default(0);
            $table->timestamps();
        });
    }

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