The scheduler runs tasks automatically — daily reports, cleaning old records, sending reminders — with just one cron entry on the server.
Define the schedule
In Laravel 11 and later, write schedules in routes/console.php with the Schedule facade (older versions use app/Console/Kernel.php).
What you can schedule
- An Artisan command:
Schedule::command('report:send') - A queued job:
Schedule::job(new CleanupJob) - A closure:
Schedule::call(fn () => ...)
Frequencies
everyMinute(), everyFiveMinutes(), hourly(), daily(), dailyAt('09:00'), weekly(), monthly(), weekdays(), timezone('Asia/Kolkata').
Add one cron entry on the server
* * * * * cd /path-to-project && php artisan schedule:run >> /dev/null 2>&1
Cron runs schedule:run every minute, and Laravel decides which tasks are due.
Useful commands
php artisan schedule:list— see all tasks and their next run timephp artisan schedule:work— run the scheduler locally while developing
Add ->withoutOverlapping() so a slow task does not start again before the last run finishes.
Example
<?php
// routes/console.php (Laravel 11+)
use App\Models\Otp;
use Illuminate\Support\Facades\Schedule;
// Delete expired OTPs every hour
Schedule::call(function () {
Otp::where('created_at', '<', now()->subHour())->delete();
})->hourly();
// Send a sales report at 9 AM India time, Monday to Friday
Schedule::command('report:send')
->weekdays()
->dailyAt('09:00')
->timezone('Asia/Kolkata')
->withoutOverlapping();
// Prune old login logs every Sunday
Schedule::command('model:prune')->weekly();
php artisan schedule:list shows three tasks with their next run times. On the server, the single cron line runs them all at the right times.