<?php

use Illuminate\Support\Facades\DB;
use App\Models\GeneralSetting;

// Bootstrapping Laravel
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

echo "Finalizing branding to phantomBD...\n";

try {
    $new_name = 'phantomBD';
    $logo_path = 'public/uploads/settings/phantomBD_logo.png';
    $headline = 'phantomBD অনলাইন শপে আপনাকে স্বাগতম || অনলাইনে আস্থা ও বিশ্বস্ততার সাথে সারা বাংলাদেশে হোম ডেলিভারি';
    
    $setting = GeneralSetting::where('status', 1)->first();
    
    if ($setting) {
        $setting->update([
            'name' => $new_name,
            'dark_logo' => $logo_path,
            'white_logo' => $logo_path,
            'top_headline' => $headline,
            'meta_description' => 'phantomBD - The best ecommerce shop in Bangladesh.',
            'meta_keyword' => 'phantomBD, ecommerce, online shop, bangladesh',
        ]);
        echo "Successfully updated GeneralSetting table including headline and meta data.\n";
    } else {
        echo "Error: No active GeneralSetting found.\n";
    }
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}

echo "Done.\n";
