Juan Girini
Juan Girini

Reputation: 1168

Laravel artisan always runs schedule

I am working with Laravel 5.1, and something strange happens: whenever I execute an artisan command the schedule (app/Console/Kernel.php::schedule) is fired. Does anybody know why this happens and if there is a way to prevent that to happen?

Upvotes: 2

Views: 1246

Answers (1)

Juan Girini
Juan Girini

Reputation: 1168

The problem was that the code within the schedule wasn't actually a schedule call, I had something like

protected function schedule(Schedule $schedule)
{
    //do something
}

When I should have had something like this

protected function schedule(Schedule $schedule)
{
    $schedule->call(function () {
        //do something
    })->hourly();
}

Upvotes: 1

Related Questions