laravel8 console调度示例

command('es:init')->dailyAt('1:00');
        $schedule->command('enterprise:status')->dailyAt('2:00');
        $schedule->command('delete:removed')->sundays();//每周日执行一次
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__ . '/Commands');

        require base_path('routes/console.php');
    }
}
removeClass) {
            foreach ($this->removeClass as $value) {
                $model = new $value;
                $model::where('isRemoved', 1)->delete();
            }
        }
        return true;
    }

    public function handle()
    {
        $this->deleteRemoved();
    }
}

你可能感兴趣的:(laravel8 console调度示例)