<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require __DIR__ . '/../../vendor/autoload.php';

$app = require_once __DIR__ . '/../../bootstrap/app.php';

$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);

$commands = [
    'config:clear',
    'route:clear',
    'view:clear',
    'cache:clear',
    'config:cache',
    'route:cache',
    'view:cache',
    //'event:cache',
];

foreach ($commands as $command) {
    echo "Running: php artisan $command ...<br>";
    $exitCode = $kernel->handle(
        $input = new Symfony\Component\Console\Input\StringInput($command),
        new Symfony\Component\Console\Output\ConsoleOutput()
    );
    echo "Done.<br>";
}

echo "✅ Comenzile Artisan au fost rulate cu succes!";
