<?php
/**
 * Clear cache script
 * Access via: http://127.0.0.1:8000/clear-cache.php
 */

// Laravel bootstrap
require __DIR__ . '/../bootstrap/app.php';

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

try {
    // Clear Laravel caches
    \Illuminate\Support\Facades\Artisan::call('cache:clear');
    \Illuminate\Support\Facades\Artisan::call('route:clear');
    \Illuminate\Support\Facades\Artisan::call('config:clear');
    \Illuminate\Support\Facades\Artisan::call('view:clear');
    
    echo json_encode([
        'status' => 'success',
        'message' => 'All caches cleared successfully!',
        'timestamp' => date('Y-m-d H:i:s')
    ]);
} catch (\Exception $e) {
    echo json_encode([
        'status' => 'error',
        'message' => $e->getMessage()
    ]);
}
?>
