Schedule Artisan commands, closures, and jobs with Laravel's expressive cron-like scheduler.
Task Scheduling
// routes/console.php (Laravel 11)
Schedule::command("reports:daily")->dailyAt("01:00");
Schedule::command("backup:run")->weekly()->mondays()->at("03:00");
Schedule::command("cleanup:logs")->daily()->between("22:00","06:00");
Schedule::call(fn() => DB::table("logs")->where("created_at","<",now()->subDays(30))->delete())
->daily();
Schedule::job(new GenerateSitemap)->hourly()->withoutOverlapping();
Schedule::command("queue:restart")->everyFiveMinutes()->runInBackground();
// Run scheduler (add to cron — once!)
// * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
// Test locally
php artisan schedule:work