vendredi 9 octobre 2020

Laravel getting error 'Trying to access array offset on value of type int' While call aritsan command Artisan::call('cache:clear');

I am trying to clear a cache using code. It throws me an error Trying to access array offset on value of type int

Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    return "Cache is cleared";
});

Error in the line elseif ('-' === $key[0])

protected function parse()
{
    foreach ($this->parameters as $key => $value) {
        if ('--' === $key) {
            return;
        }
        if (0 === strpos($key, '--')) {
            $this->addLongOption(substr($key, 2), $value);
        } elseif ('-' === $key[0]) {
            $this->addShortOption(substr($key, 1), $value);
        } else {
            $this->addArgument($key, $value);
        }
    }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire