I have a tasks schedule to run every Monday and Wednesday, I set the scheduler to run like below:

// Incorrect.

At first, I thought it would run every Wednesday and Friday. Reading more carefully with the documentation, wednesdays() and fridays() are the schedule constraints. The way I setup meaning that it will honor the last contraint I set. In this case, it will be fridays().

So, one way to meet my requirement with the fluent schedule setters with Laravel, it will be:

         ->cron('* * * * 3,5')  // Wednesday and Friday

Of course, you can set it as

         ->cron('5 5 * * 3,5');

It’s up to you.

Next | Previous