<?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
    {
        // Add default language setting if it doesn't exist
        \App\Models\Setting::updateOrCreate(
            ['key' => 'default_language', 'lang' => 'all'],
            ['value' => config('app.locale', 'en')]
        );
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        // Remove default language setting
        \App\Models\Setting::where('key', 'default_language')
            ->where('lang', 'all')
            ->delete();
    }
};
