Schedule
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
Create a new schedule instance
Run the task every minute
Run the task every two minutes
Run the task every five minutes
Run the task every ten minutes
Run the task every fifteen minutes
Run the task every thirty minutes
Run the task every two hours
Run the task every three hours
Run the task every four hours
Run the task every six hours
Run the task twice daily
Run the task weekly on a given day and time
Run the task monthly on a given day and time
Run the task twice monthly
Run the task yearly on a given month, day, and time
Schedule the task to run on Wednesdays
Indicate that the job should run in background
Indicate that overlapping should be prevented
Set the description of the scheduled task
Get the cron expression
Get the timezone
Get the description
Determine if the task should prevent overlapping
Get the expires at value
Check if the task should run in background
Determine if the filters pass for the task
Check if a cron part matches the given value
Splice a value into the cron expression
Get the owning scheduled event
Set the queue connection to use for task execution
Details
void
__construct()
Create a new schedule instance
Schedule
everyMinute()
Run the task every minute
Schedule
everyTwoMinutes()
Run the task every two minutes
Schedule
everyFiveMinutes()
Run the task every five minutes
Schedule
everyTenMinutes()
Run the task every ten minutes
Schedule
everyFifteenMinutes()
Run the task every fifteen minutes
Schedule
everyThirtyMinutes()
Run the task every thirty minutes
Schedule
hourly()
Run the task hourly
Schedule
hourlyAt(array|int $offset)
Run the task hourly at a given offset
Schedule
everyTwoHours()
Run the task every two hours
Schedule
everyThreeHours()
Run the task every three hours
Schedule
everyFourHours()
Run the task every four hours
Schedule
everySixHours()
Run the task every six hours
Schedule
daily()
Run the task daily
Schedule
dailyAt(string $time)
Run the task daily at a given time
Schedule
twiceDaily(int $first = 1, int $second = 13)
Run the task twice daily
Schedule
weekly()
Run the task weekly
Schedule
weeklyOn(array|int $dayOfWeek, string $time = '0:0')
Run the task weekly on a given day and time
Schedule
monthly()
Run the task monthly
Schedule
monthlyOn(int $dayOfMonth = 1, string $time = '0:0')
Run the task monthly on a given day and time
Schedule
twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0')
Run the task twice monthly
Schedule
quarterly()
Run the task quarterly
Schedule
yearly()
Run the task yearly
Schedule
yearlyOn(int $month = 1, int $dayOfMonth = 1, string $time = '0:0')
Run the task yearly on a given month, day, and time
Schedule
days(array|int|string $days)
Schedule the task to run on given days of the week
Schedule
mondays()
Schedule the task to run on Mondays
Schedule
tuesdays()
Schedule the task to run on Tuesdays
Schedule
wednesdays()
Schedule the task to run on Wednesdays
Schedule
thursdays()
Schedule the task to run on Thursdays
Schedule
fridays()
Schedule the task to run on Fridays
Schedule
saturdays()
Schedule the task to run on Saturdays
Schedule
sundays()
Schedule the task to run on Sundays
Schedule
weekdays()
Schedule the task to run on weekdays
Schedule
weekends()
Schedule the task to run on weekends
Schedule
cron(string $expression)
Set the cron expression with a custom expression
Schedule
timezone(DateTimeZone|string $timezone)
Set the timezone the date should be evaluated on
Schedule
runInBackground()
Indicate that the job should run in background
Schedule
withoutOverlapping(int $expiresAt = 1440)
Indicate that overlapping should be prevented
Schedule
when(callable $callback)
Register a callback to further filter the schedule
Schedule
skip(callable $callback)
Register a callback to further filter the schedule
Schedule
description(string $description)
Set the description of the scheduled task
string
getExpression()
Get the cron expression
DateTimeZone|null
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
protected array
getDateParts(DateTimeInterface $date)
Get the date parts from a DateTime
protected bool
matchesCronPart(string $cronPart, int $value)
Check if a cron part matches the given value
protected Schedule
spliceIntoPosition(int $position, int|string $value)
Splice a value into the cron expression
Schedule
setEvent(ScheduledEvent $event)
Set the owning scheduled event
ScheduledEvent|null
getEvent()
Get the owning scheduled event
Schedule
onConnection(string $connection)
Set the queue connection to use for task execution