PHP code example of cyberwizard / schedule-catchup
1. Go to this page and download the library: Download cyberwizard/schedule-catchup library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cyberwizard / schedule-catchup example snippets
use Illuminate\Support\Facades\Schedule;
Schedule::command('subscriptions:process-unlimited')
->dailyAt('00:00')
->onOneServer()
->replayOnCatchup();
use Cyberwizard\ScheduleCatchup\Traits\ResolvesScheduledTime;
class MyCommand extends Command
{
use ResolvesScheduledTime;
public function handle()
{
$date = $this->scheduledFor();
if ($this->isCatchupReplay()) {
// ...
}
}
}
use Cyberwizard\ScheduleCatchup\Traits\RecordsScheduleRun;
class MyCommand extends Command
{
use RecordsScheduleRun;
public function handle()
{
$this->runOnceForPeriod('key-'.now()->format('Y-m'), function (): void {
// ...
});
}
}