I had a queued job that I wanted to run every thirty minutes, but only during the daytime.
Turns out that Laravel has two methods that allow you to control the times of day that a scheduled job is executed:
// file: app/Console/Kernel.php
protected function schedule(Schedule $schedule)
// Only runs between 7 a.m. and 11 p.m.
// Runs at all times except from 2 a.m. to 8 a.m.
You can do the same things with either method, so it’s up to you to pick whichever one feels better.
Subscribe to my newsletter!
A weekly round-up of new blog posts and updates to projects I’m working on.