mercredi 20 janvier 2016

How can I schedule a laravel task on a specific day of the month?

Now reading through the docs I don't see a direct function for that, but I do see the option to use the monthly() method combined with a when() method, so I thought, could I do this maybe:

$schedule->command('send:reminders')->monthly()->when(function() {
    return date('d') == '23';
});

But now I'm afraid that won't work, because as far as I can see it will try the when() constraint only once a month (probably not on the date that I want it to) and then when it fails it skips that month. At least that's what I'm guessing from reading the source of laravel.

So then I'm lost, how do I make this happen?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire