class Schedule (View source)

Properties

protected string $expression

The cron expression representing the task's frequency

protected DateTimeZone $timezone

The timezone the date should be evaluated on

protected bool $withoutOverlapping

Indicates if overlapping should be prevented

protected int $expiresAt

The number of minutes the mutex should be valid

protected bool $runInBackground

Indicates if output should be appended

protected array $filters

The array of callbacks to filter when the task should run

protected array $rejects

The array of callbacks to reject when the task should run

protected ?string $description

The description of the scheduled task

protected ScheduledEvent $event

The owning scheduled event

Methods

void
__construct()

Create a new schedule instance

everyMinute()

Run the task every minute

everyTwoMinutes()

Run the task every two minutes

everyFiveMinutes()

Run the task every five minutes

everyTenMinutes()

Run the task every ten minutes

everyFifteenMinutes()

Run the task every fifteen minutes

everyThirtyMinutes()

Run the task every thirty minutes

hourly()

Run the task hourly

hourlyAt(array|int $offset)

Run the task hourly at a given offset

everyTwoHours()

Run the task every two hours

everyThreeHours()

Run the task every three hours

everyFourHours()

Run the task every four hours

everySixHours()

Run the task every six hours

daily()

Run the task daily

dailyAt(string $time)

Run the task daily at a given time

twiceDaily(int $first = 1, int $second = 13)

Run the task twice daily

weekly()

Run the task weekly

weeklyOn(array|int $dayOfWeek, string $time = '0:0')

Run the task weekly on a given day and time

monthly()

Run the task monthly

monthlyOn(int $dayOfMonth = 1, string $time = '0:0')

Run the task monthly on a given day and time

twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0')

Run the task twice monthly

quarterly()

Run the task quarterly

yearly()

Run the task yearly

yearlyOn(int $month = 1, int $dayOfMonth = 1, string $time = '0:0')

Run the task yearly on a given month, day, and time

days(array|int|string $days)

Schedule the task to run on given days of the week

mondays()

Schedule the task to run on Mondays

tuesdays()

Schedule the task to run on Tuesdays

wednesdays()

Schedule the task to run on Wednesdays

thursdays()

Schedule the task to run on Thursdays

fridays()

Schedule the task to run on Fridays

saturdays()

Schedule the task to run on Saturdays

sundays()

Schedule the task to run on Sundays

weekdays()

Schedule the task to run on weekdays

weekends()

Schedule the task to run on weekends

cron(string $expression)

Set the cron expression with a custom expression

timezone(DateTimeZone|string $timezone)

Set the timezone the date should be evaluated on

runInBackground()

Indicate that the job should run in background

withoutOverlapping(int $expiresAt = 1440)

Indicate that overlapping should be prevented

when(callable $callback)

Register a callback to further filter the schedule

skip(callable $callback)

Register a callback to further filter the schedule

description(string $description)

Set the description of the scheduled task

string
getExpression()

Get the cron expression

getTimezone()

Get the timezone

string|null
getDescription()

Get the description

bool
shouldPreventOverlapping()

Determine if the task should prevent overlapping

int
getExpiresAt()

Get the expires at value

bool
shouldRunInBackground()

Check if the task should run in background

bool
filtersPass()

Determine if the filters pass for the task

bool
isDue(DateTimeInterface $currentTime)

Determine if the task is due to run

array
getDateParts(DateTimeInterface $date)

Get the date parts from a DateTime

bool
matchesCronPart(string $cronPart, int $value)

Check if a cron part matches the given value

spliceIntoPosition(int $position, int|string $value)

Splice a value into the cron expression

setEvent(ScheduledEvent $event)

Set the owning scheduled event

getEvent()

Get the owning scheduled event

onConnection(string $connection)

Set the queue connection to use for task execution

Details

void __construct()

Create a new schedule instance

Return Value

void

Schedule everyMinute()

Run the task every minute

Return Value

Schedule

Schedule everyTwoMinutes()

Run the task every two minutes

Return Value

Schedule

Schedule everyFiveMinutes()

Run the task every five minutes

Return Value

Schedule

Schedule everyTenMinutes()

Run the task every ten minutes

Return Value

Schedule

Schedule everyFifteenMinutes()

Run the task every fifteen minutes

Return Value

Schedule

Schedule everyThirtyMinutes()

Run the task every thirty minutes

Return Value

Schedule

Schedule hourly()

Run the task hourly

Return Value

Schedule

Schedule hourlyAt(array|int $offset)

Run the task hourly at a given offset

Parameters

array|int $offset

Return Value

Schedule

Schedule everyTwoHours()

Run the task every two hours

Return Value

Schedule

Schedule everyThreeHours()

Run the task every three hours

Return Value

Schedule

Schedule everyFourHours()

Run the task every four hours

Return Value

Schedule

Schedule everySixHours()

Run the task every six hours

Return Value

Schedule

Schedule daily()

Run the task daily

Return Value

Schedule

Schedule dailyAt(string $time)

Run the task daily at a given time

Parameters

string $time

Return Value

Schedule

Schedule twiceDaily(int $first = 1, int $second = 13)

Run the task twice daily

Parameters

int $first
int $second

Return Value

Schedule

Schedule weekly()

Run the task weekly

Return Value

Schedule

Schedule weeklyOn(array|int $dayOfWeek, string $time = '0:0')

Run the task weekly on a given day and time

Parameters

array|int $dayOfWeek
string $time

Return Value

Schedule

Schedule monthly()

Run the task monthly

Return Value

Schedule

Schedule monthlyOn(int $dayOfMonth = 1, string $time = '0:0')

Run the task monthly on a given day and time

Parameters

int $dayOfMonth
string $time

Return Value

Schedule

Schedule twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0')

Run the task twice monthly

Parameters

int $first
int $second
string $time

Return Value

Schedule

Schedule quarterly()

Run the task quarterly

Return Value

Schedule

Schedule yearly()

Run the task yearly

Return Value

Schedule

Schedule yearlyOn(int $month = 1, int $dayOfMonth = 1, string $time = '0:0')

Run the task yearly on a given month, day, and time

Parameters

int $month
int $dayOfMonth
string $time

Return Value

Schedule

Schedule days(array|int|string $days)

Schedule the task to run on given days of the week

Parameters

array|int|string $days

Return Value

Schedule

Schedule mondays()

Schedule the task to run on Mondays

Return Value

Schedule

Schedule tuesdays()

Schedule the task to run on Tuesdays

Return Value

Schedule

Schedule wednesdays()

Schedule the task to run on Wednesdays

Return Value

Schedule

Schedule thursdays()

Schedule the task to run on Thursdays

Return Value

Schedule

Schedule fridays()

Schedule the task to run on Fridays

Return Value

Schedule

Schedule saturdays()

Schedule the task to run on Saturdays

Return Value

Schedule

Schedule sundays()

Schedule the task to run on Sundays

Return Value

Schedule

Schedule weekdays()

Schedule the task to run on weekdays

Return Value

Schedule

Schedule weekends()

Schedule the task to run on weekends

Return Value

Schedule

Schedule cron(string $expression)

Set the cron expression with a custom expression

Parameters

string $expression

Return Value

Schedule

Schedule timezone(DateTimeZone|string $timezone)

Set the timezone the date should be evaluated on

Parameters

DateTimeZone|string $timezone

Return Value

Schedule

Schedule runInBackground()

Indicate that the job should run in background

Return Value

Schedule

Schedule withoutOverlapping(int $expiresAt = 1440)

Indicate that overlapping should be prevented

Parameters

int $expiresAt

Return Value

Schedule

Schedule when(callable $callback)

Register a callback to further filter the schedule

Parameters

callable $callback

Return Value

Schedule

Schedule skip(callable $callback)

Register a callback to further filter the schedule

Parameters

callable $callback

Return Value

Schedule

Schedule description(string $description)

Set the description of the scheduled task

Parameters

string $description

Return Value

Schedule

string getExpression()

Get the cron expression

Return Value

string

DateTimeZone|null getTimezone()

Get the timezone

Return Value

DateTimeZone|null

string|null getDescription()

Get the description

Return Value

string|null

bool shouldPreventOverlapping()

Determine if the task should prevent overlapping

Return Value

bool

int getExpiresAt()

Get the expires at value

Return Value

int

bool shouldRunInBackground()

Check if the task should run in background

Return Value

bool

bool filtersPass()

Determine if the filters pass for the task

Return Value

bool

bool isDue(DateTimeInterface $currentTime)

Determine if the task is due to run

Parameters

DateTimeInterface $currentTime

Return Value

bool

protected array getDateParts(DateTimeInterface $date)

Get the date parts from a DateTime

Parameters

DateTimeInterface $date

Return Value

array

protected bool matchesCronPart(string $cronPart, int $value)

Check if a cron part matches the given value

Parameters

string $cronPart
int $value

Return Value

bool

protected Schedule spliceIntoPosition(int $position, int|string $value)

Splice a value into the cron expression

Parameters

int $position
int|string $value

Return Value

Schedule

Schedule setEvent(ScheduledEvent $event)

Set the owning scheduled event

Parameters

ScheduledEvent $event

Return Value

Schedule

ScheduledEvent|null getEvent()

Get the owning scheduled event

Return Value

ScheduledEvent|null

Schedule onConnection(string $connection)

Set the queue connection to use for task execution

Parameters

string $connection

Return Value

Schedule