<?php
/**
 * Nuke the Vite hot file + clear all views
 * DELETE AFTER USE
 */

echo "<h2>🔥 Final Fix</h2><pre style='background:#1e1e1e;color:#d4d4d4;padding:20px;font-size:13px;'>";

// 1. Delete the Vite "hot" file — this forces dev mode even in production!
$hotPaths = [
    __DIR__ . '/hot',
    __DIR__ . '/../hot',
    __DIR__ . '/public/hot',
    __DIR__ . '/../public/hot',
];

foreach ($hotPaths as $hp) {
    if (file_exists($hp)) {
        unlink($hp);
        echo "✅ Deleted: $hp\n";
    } else {
        echo "   Not found: $hp\n";
    }
}

// 2. Nuke ALL compiled views
$viewDirs = [
    __DIR__ . '/../storage/framework/views',
    __DIR__ . '/storage/framework/views',
];
foreach ($viewDirs as $vd) {
    if (is_dir($vd)) {
        $files = glob($vd . '/*.php');
        foreach ($files as $f) { unlink($f); }
        echo "✅ Cleared " . count($files) . " compiled views from $vd\n";
    } else {
        echo "   Not a dir: $vd\n";
    }
}

// 3. Delete bootstrap/cache config
$bootstrapCache = [
    __DIR__ . '/../bootstrap/cache/config.php',
    __DIR__ . '/../bootstrap/cache/services.php',
    __DIR__ . '/../bootstrap/cache/packages.php',
    __DIR__ . '/../bootstrap/cache/routes-v7.php',
];
foreach ($bootstrapCache as $bc) {
    if (file_exists($bc)) {
        unlink($bc);
        echo "✅ Deleted: $bc\n";
    }
}

echo "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n";
echo "✅ DONE! Now hard-refresh:\n";
echo "   https://sarkinmota-autos.com/\n";
echo "   (Press Ctrl+Shift+R or Ctrl+F5)\n";
echo "\n⚠️ DELETE this file NOW!\n";
echo "</pre>";
