Skip to content

Error when schedule not queued jobs #21818

@projct1

Description

@projct1
  • Laravel Version: 5.5.18

Description:

Trying to use not queued jobs in schedule, but getting error: Call to undefined method UpdateStatusSmsJob::onQueue(). Why? For queues has worker...

class Kernel extends ConsoleKernel
{
    ...

    protected function schedule(Schedule $schedule)
    {
        $schedule->job(new UpdateStatusSmsJob)->cron('*/3 * * * *');
    }

    ...
}

I have to use this:

    protected function schedule(Schedule $schedule)
    {
        $schedule->call(function() {
            dispatch_now(new UpdateStatusSmsJob);
        })->cron('*/3 * * * *');
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions