37 lines
1.4 KiB
PHP
37 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
use App\Jobs\DeleteOldResetTokens;
|
||
|
|
use App\Jobs\FetchAndUpsertArcadiaEmployees;
|
||
|
|
use App\Jobs\SendMissingOrderReminderJob;
|
||
|
|
use App\Jobs\SendReminderMail;
|
||
|
|
use App\Jobs\UpdateSlidesStatus;
|
||
|
|
use App\Jobs\UpsertShopsPickupExceptionsUsingApiForYear;
|
||
|
|
use Domain\Services\PickupSchedulingService;
|
||
|
|
use Illuminate\Console\Scheduling\Schedule;
|
||
|
|
|
||
|
|
return function (Schedule $schedule): void {
|
||
|
|
$schedule->job(DeleteOldResetTokens::class)->everyMinute();
|
||
|
|
$schedule->job(UpdateSlidesStatus::class)->everyMinute();
|
||
|
|
$schedule->job(FetchAndUpsertArcadiaEmployees::class)->onOneServer()->dailyAt('00:00');
|
||
|
|
$schedule->job(SendReminderMail::class)->onOneServer()->dailyAt('10:00');
|
||
|
|
$schedule->job(SendMissingOrderReminderJob::class)
|
||
|
|
->onOneServer()
|
||
|
|
->hourly()
|
||
|
|
->when(function () {
|
||
|
|
$schedulingService = app(PickupSchedulingService::class);
|
||
|
|
|
||
|
|
$now = \Date::now();
|
||
|
|
$currentCutoffAt = $schedulingService->currentCutoff();
|
||
|
|
$pickupReminderAt = $currentCutoffAt->copy()
|
||
|
|
->subDays(SendMissingOrderReminderJob::DAYS_BEFORE_CUTOFF)
|
||
|
|
->subHours(SendMissingOrderReminderJob::HOURS_BEFORE_CUTOFF);
|
||
|
|
|
||
|
|
return $now->isSameHour($pickupReminderAt);
|
||
|
|
});
|
||
|
|
$schedule->job(UpsertShopsPickupExceptionsUsingApiForYear::class)
|
||
|
|
->onOneServer()
|
||
|
|
->yearlyOn(11, 1, '7:30');
|
||
|
|
};
|