<?php

require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();

use App\Models\GeneralSetting;

echo "--- Branding Status ---\n";
$settings = GeneralSetting::all();
foreach ($settings as $s) {
    echo "ID: {$s->id} | Name: {$s->name} | Status: {$s->status} | Headline: {$s->top_headline}\n";
}

echo "\nUpdating all records to phantomBD to be safe...\n";
foreach ($settings as $s) {
    if ($s->status == 1) {
        $s->update([
            'name' => 'phantomBD',
            'top_headline' => 'phantomBD অনলাইন শপে আপনাকে স্বাগতম || অনলাইনে আস্থা ও বিশ্বস্ততার সাথে সারা বাংলাদেশে হোম ডেলিভারি',
            'dark_logo' => 'public/uploads/settings/phantomBD_logo.png',
            'white_logo' => 'public/uploads/settings/phantomBD_logo.png',
            'favicon' => 'public/uploads/settings/phantomBD_logo.png',
            'meta_description' => 'phantomBD - The best ecommerce shop in Bangladesh.',
        ]);
        echo "Updated ID: {$s->id}\n";
    }
}

echo "Cleanup: clearing cache...\n";
\Illuminate\Support\Facades\Artisan::call('config:cache');
\Illuminate\Support\Facades\Artisan::call('view:clear');

echo "Done.\n";
