首页 > 解决方案 > 如何使用 php artisan serve 命令运行我的调度程序?

问题描述

schedule->call(what_i_want_to_do)在 Kernel.php 文件中的 schedule 函数中添加了一个。我知道我可以通过运行php artisan schedule:run命令来尝试,但是,当我使用php artisan serve命令启动服务器时,我的调度程序不起作用。

如何使它工作?

我的 kernel.php 时间表

protected function schedule(Schedule $schedule)
{
    $schedule->call(function () {
        Defi::whereDate('date_vis', '=', now())->update(['vis' => 1]);
    })->everyMinute();
}

标签: phplaravel

解决方案


认为您还需要运行php artisan schedule:work

https://laravel.com/docs/scheduling#running-the-scheduler-locally


推荐阅读