<?php

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

return new class extends Migration
{
    public function up()
    {
        Schema::table('general_settings', function (Blueprint $table) {
            if (!Schema::hasColumn('general_settings', 'landing_bg_gradient_1')) {
                $table->string('landing_bg_gradient_1', 20)->nullable();
                $table->string('landing_bg_gradient_2', 20)->nullable();
                $table->string('landing_bg_gradient_3', 20)->nullable();
                $table->string('landing_card_gradient_1', 20)->nullable();
                $table->string('landing_card_gradient_2', 20)->nullable();
                $table->string('landing_card_gradient_3', 20)->nullable();
            }
        });
    }

    public function down()
    {
        if (Schema::hasColumn('general_settings', 'landing_bg_gradient_1')) {
            Schema::table('general_settings', function (Blueprint $table) {
                $table->dropColumn([
                    'landing_bg_gradient_1', 'landing_bg_gradient_2', 'landing_bg_gradient_3',
                    'landing_card_gradient_1', 'landing_card_gradient_2', 'landing_card_gradient_3'
                ]);
            });
        }
    }
};
