Allow dailyAt() to accept an array of times in Task Scheduling #59294
Unanswered
Welington-dos-Santos
asked this question in
Ideas
Replies: 1 comment
-
|
I actually ran into this exact issue last week and ended up using a foreach loop as a workaround, which felt pretty dirty. I'd also love to see this on $schedule->command('report:send')->weeklyOn(1, ['08:00', '14:00']); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'd like to open a discussion about a small but potentially useful improvement to the
dailyAtmethod in Laravel's Task Scheduling.Currently, if you want to run a command at multiple times during the day, you have to repeat the same line:
While
twiceDailyAtcovers the most common case, it only supports two fixed times and does not allow more than that. My idea is to extenddailyAtto accept an array of times:Instead of trying to merge everything into a single CRON expression (which would cause ambiguity when minutes differ), the implementation would simply register multiple scheduler entries internally — one per time — keeping the behavior predictable and the API clean.
The main architectural question is where this logic should live. Since
dailyAtoperates on a singleEventinstance, the best approach might be to handle the array at theSchedulelevel rather than insideEventitself.I'm considering opening a PR for this. Would love to hear your thoughts:
EventorSchedule?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions