<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('applies', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained()->onDelete('cascade');
            $table->foreignId('category_id')->nullable()->constrained()->onDelete('cascade'); 
            $table->string('name');
            $table->string('number');
            $table->string('email');
            $table->string('address');
            $table->date('date');
            $table->time('time');
            $table->enum('paymethod', ['Наличные', 'Банковская карта']);
            $table->string('customcategory')->nullable();
            $table->enum('status', ['Новая заявка', 'Услуга оказана', 'Услуга отменена'])->default('Новая заявка');
            $table->text('comment')->nullable();
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('applies');
    }
};

