uccdev
117
1
Laravel

"Call to undefined method App\Console\Kernel::job()"

Posted 1 month ago by uccdev

I'm running a schedule on my laravel class which goes like this:

      protected function schedule(Schedule $schedule)
      {
                $schedule->call(function () {
                          $schedule->job(new ServerJob("hi"));
                })->everyFiveMinutes();
      }

When I run this, I get an error message in the logs:

     [2019-05-22 15:15:02] local.ERROR: Call to undefined method App\Console\Kernel::job() {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to undefined method App\Console\Kernel::job() at /home/vagrant/myProject/myApp/app/Console/Kernel.php:37)

[stacktrace]

How do I fix this? I know that if I use "$schedule->job(...)" outside of schedule, it all works fine, but I'm trying to use this method to solve a scheduling issue (as listed here: https://www.laracasts.com/discuss/channels/laravel/task-scheduling-runs-every-minute-despite-my-directions)

Any advice?

Please sign in or create an account to participate in this conversation.