LoginSignup
0
2

More than 3 years have passed since last update.

[ Laravel ]特定の曜日を回避してタスクを実行させる

Last updated at Posted at 2019-07-24

金曜日と土曜日は実行させない(skipする)で、それ以外の曜日は10:00, 17:00に実行させる

kernel.php
$schedule->command('app:command')
                ->skip(function (){
                    $today = Carbon::today();
                    return $today->isFriday() | $today->isSaturday();
                })->twiceDaily(10, 17);

Carbon使わなくても、

kernel.php
$schedule->command('app:command')
                ->mondays()
                ->tuesdays()
                ->wednesdays()
                ->thursdays()
                ->saturdays()
                ->twiceDaily(10, 17);

でいける。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2