Reputation: 1347
There are some commands:
protected function schedule(Schedule $schedule)
{
$schedule->command('Events:complete')->everyFiveMinutes();
$schedule->command('Payments:authorize')->everyFiveMinutes();
$schedule->command('Requests:processing')->hourly();
}
Every one of them should be performed with their own periodicity. But I wanna add one more condition - run that commands only between 08:00 and 20:00. Can Laravel do it, or should I check time via pure php?
Laravel 5.4
Upvotes: 1
Views: 789
Reputation: 597
You can use the between method. You will find it here : https://laravel.com/docs/5.4/scheduling#schedule-frequency-options
It would be something like that for you :
protected function schedule(Schedule $schedule)
{
$schedule->command('Events:complete')->everyFiveMinutes()->between('08:00', '20:00');
$schedule->command('Payments:authorize')->everyFiveMinutes()->between('08:00', '20:00');
$schedule->command('Requests:processing')->hourly()->between('08:00', '20:00');
}
Upvotes: 6