<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('drivers', function (Blueprint $table) {
            // جعل الحقول المطلوبة nullable
            $table->string('license_number')->nullable()->change();
            $table->date('license_expiry')->nullable()->change();
            $table->string('national_id')->nullable()->change();
            $table->string('phone')->nullable()->change();
            $table->string('emergency_contact')->nullable()->change();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('drivers', function (Blueprint $table) {
            // إعادة الحقول إلى مطلوبة
            $table->string('license_number')->nullable(false)->change();
            $table->date('license_expiry')->nullable(false)->change();
            $table->string('national_id')->nullable(false)->change();
            $table->string('phone')->nullable(false)->change();
            $table->string('emergency_contact')->nullable(false)->change();
        });
    }
};
