<?php

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

class CreateProjectsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('projects', function (Blueprint $table) {
            
            $table->id();
            $table->string('title_ar')->nullable();
            $table->string('title_en')->nullable();
            // $table->string('category_id');
            $table->string('desc_ar')->nullable();
            $table->string('desc_en')->nullable();
            $table->longText('photo')->nullable();
            $table->timestamp('completion_date')->nullable();
            $table->string('address')->nullable();

            $table->foreignId('company_id')->constrained('manufacturing_companies')->onDelete('cascade');
            $table->foreignId('customer_id')->constrained('users')->onDelete('cascade');

            $table->string('slug')->nullable();

            $table->timestamps();

        });
    }

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