This could be caused by the fact that the command is not returning a successful exit code. By default, Laravel considers any non-zero exit code as a failure.
To fix this, you can modify your command to return a successful exit code explicitly. For example, at the end of your command, you can add:
return 0;
This will ensure that the command always returns a successful exit code, even if there were no errors.
Alternatively, you can modify the schedule to consider non-zero exit codes as successful by adding the following to your App\Console\Kernel.php file:
protected function scheduleTimezone()
{
return 'UTC';
}
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->command('my-command')
->everyMinute()
->onSuccess(function () {
return true;
})
->onFailure(function () {
return true;
});
}
This will tell Laravel to consider any exit code as successful, regardless of whether it is zero or not.