Event
class Event
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| string | $command | The command string. |
|
| string | $expression | The cron expression representing the event's frequency. |
|
| DateTimeZone|string | $timezone | The timezone the date should be evaluated on. |
|
| string | $user | The user the command should run as. |
|
| array | $environments | The list of environments the command should run under. |
|
| bool | $evenInMaintenanceMode | Indicates if the command should run in maintenance mode. |
|
| bool | $withoutOverlapping | Indicates if the command should not overlap itself. |
|
| int | $expiresAt | The amount of time the mutex should be valid. |
|
| bool | $runInBackground | Indicates if the command should run in background. |
|
| protected array | $filters | The array of filter callbacks. |
|
| protected array | $rejects | The array of reject callbacks. |
|
| string | $output | The location that output should be sent to. |
|
| bool | $shouldAppendOutput | Indicates whether output should be appended. |
|
| protected array | $beforeCallbacks | The array of callbacks to be run before the event is started. |
|
| protected array | $afterCallbacks | The array of callbacks to be run after the event is finished. |
|
| string | $description | The human readable description of the event. |
|
| Mutex | $mutex | The mutex implementation. |
Methods
Dynamically handle calls to the class.
Dynamically handle calls to the class.
The Cron expression representing the event's frequency.
Schedule the event to run between start and end time.
Schedule the event to not run between start and end time.
Schedule the event to run hourly at a given offset in the hour.
Schedule the event to run daily at a given time (10:00, 19:30, etc).
Schedule the event to run twice daily.
Schedule the event to run weekly on a given day and time.
Schedule the event to run monthly on a given day and time.
Schedule the event to run twice monthly.
Set the days of the week the command should run on.
Splice the given value into the given position of the expression.
Get the default output depending on the OS.
Get the mutex name for the scheduled command.
Build the command string.
Determine if the event runs in maintenance mode.
Determine if the Cron expression passes.
Determine if the event runs in the given environment.
Send the output of the command to a given location.
Append the output of the command to a given location.
E-mail the results of the scheduled operation.
E-mail the results of the scheduled operation if it produces output.
Ensure that output is being captured for email.
E-mail the output of the event to the recipients.
Get the e-mail subject line for output results.
Register a callback to ping a given URL before the job runs.
Register a callback to ping a given URL after the job runs.
State that the command should run in background.
Set which user the command should run as.
Limit the environments the command should run in.
State that the command should run even in maintenance mode.
Do not allow the event to overlap each other.
Set the human-friendly description of the event.
Set the human-friendly description of the event.
Get the summary of the event for display.
Determine the next due date for an event.
Get the Cron expression for the event.
Details
in
Macroable at line 24
static void
macro(string $name, callable $macro)
Register a custom macro.
in
Macroable at line 35
static bool
hasMacro(string $name)
Checks if macro is registered.
in
Macroable at line 49
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 71
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
ManagesFrequencies at line 15
$this
cron(string $expression)
The Cron expression representing the event's frequency.
in
ManagesFrequencies at line 29
$this
between(string $startTime, string $endTime)
Schedule the event to run between start and end time.
in
ManagesFrequencies at line 41
$this
unlessBetween(string $startTime, string $endTime)
Schedule the event to not run between start and end time.
in
ManagesFrequencies at line 69
$this
hourly()
Schedule the event to run hourly.
in
ManagesFrequencies at line 80
$this
hourlyAt(int $offset)
Schedule the event to run hourly at a given offset in the hour.
in
ManagesFrequencies at line 90
$this
daily()
Schedule the event to run daily.
in
ManagesFrequencies at line 102
$this
at(string $time)
Schedule the command at a given time.
in
ManagesFrequencies at line 113
$this
dailyAt(string $time)
Schedule the event to run daily at a given time (10:00, 19:30, etc).
in
ManagesFrequencies at line 128
$this
twiceDaily(int $first = 1, int $second = 13)
Schedule the event to run twice daily.
in
ManagesFrequencies at line 141
$this
weekdays()
Schedule the event to run only on weekdays.
in
ManagesFrequencies at line 151
$this
weekends()
Schedule the event to run only on weekends.
in
ManagesFrequencies at line 161
$this
mondays()
Schedule the event to run only on Mondays.
in
ManagesFrequencies at line 171
$this
tuesdays()
Schedule the event to run only on Tuesdays.
in
ManagesFrequencies at line 181
$this
wednesdays()
Schedule the event to run only on Wednesdays.
in
ManagesFrequencies at line 191
$this
thursdays()
Schedule the event to run only on Thursdays.
in
ManagesFrequencies at line 201
$this
fridays()
Schedule the event to run only on Fridays.
in
ManagesFrequencies at line 211
$this
saturdays()
Schedule the event to run only on Saturdays.
in
ManagesFrequencies at line 221
$this
sundays()
Schedule the event to run only on Sundays.
in
ManagesFrequencies at line 231
$this
weekly()
Schedule the event to run weekly.
in
ManagesFrequencies at line 245
$this
weeklyOn(int $day, string $time = '0:0')
Schedule the event to run weekly on a given day and time.
in
ManagesFrequencies at line 257
$this
monthly()
Schedule the event to run monthly.
in
ManagesFrequencies at line 271
$this
monthlyOn(int $day = 1, string $time = '0:0')
Schedule the event to run monthly on a given day and time.
in
ManagesFrequencies at line 285
$this
twiceMonthly(int $first = 1, int $second = 16)
Schedule the event to run twice monthly.
in
ManagesFrequencies at line 299
$this
quarterly()
Schedule the event to run quarterly.
in
ManagesFrequencies at line 312
$this
yearly()
Schedule the event to run yearly.
in
ManagesFrequencies at line 325
$this
everyMinute()
Schedule the event to run every minute.
in
ManagesFrequencies at line 335
$this
everyFiveMinutes()
Schedule the event to run every five minutes.
in
ManagesFrequencies at line 345
$this
everyTenMinutes()
Schedule the event to run every ten minutes.
in
ManagesFrequencies at line 355
$this
everyThirtyMinutes()
Schedule the event to run every thirty minutes.
in
ManagesFrequencies at line 366
$this
days(array|mixed $days)
Set the days of the week the command should run on.
in
ManagesFrequencies at line 379
$this
timezone(DateTimeZone|string $timezone)
Set the timezone the date should be evaluated on.
in
ManagesFrequencies at line 393
protected $this
spliceIntoPosition(int $position, string $value)
Splice the given value into the given position of the expression.
at line 144
void
__construct(Mutex $mutex, string $command)
Create a new event instance.
at line 156
string
getDefaultOutput()
Get the default output depending on the OS.
at line 167
void
run(Container $container)
Run the given event.
at line 184
string
mutexName()
Get the mutex name for the scheduled command.
at line 195
protected void
runCommandInForeground(Container $container)
Run the command in the foreground.
at line 212
protected void
runCommandInBackground(Container $container)
Run the command in the background.
at line 227
void
callBeforeCallbacks(Container $container)
Call all of the "before" callbacks for the event.
at line 240
void
callAfterCallbacks(Container $container)
Call all of the "after" callbacks for the event.
at line 252
string
buildCommand()
Build the command string.
at line 263
bool
isDue(Application $app)
Determine if the given event should run based on the Cron expression.
at line 278
bool
runsInMaintenanceMode()
Determine if the event runs in maintenance mode.
at line 288
protected bool
expressionPasses()
Determine if the Cron expression passes.
at line 305
bool
runsInEnvironment(string $environment)
Determine if the event runs in the given environment.
at line 316
bool
filtersPass(Application $app)
Determine if the filters pass for the event.
at line 340
$this
sendOutputTo(string $location, bool $append = false)
Send the output of the command to a given location.
at line 355
$this
appendOutputTo(string $location)
Append the output of the command to a given location.
at line 369
$this
emailOutputTo(array|mixed $addresses, bool $onlyIfOutputExists = false)
E-mail the results of the scheduled operation.
at line 388
$this
emailWrittenOutputTo(array|mixed $addresses)
E-mail the results of the scheduled operation if it produces output.
at line 398
protected void
ensureOutputIsBeingCapturedForEmail()
Ensure that output is being captured for email.
at line 413
protected void
emailOutput(Mailer $mailer, array $addresses, bool $onlyIfOutputExists = false)
E-mail the output of the event to the recipients.
at line 431
protected string
getEmailSubject()
Get the e-mail subject line for output results.
at line 446
$this
pingBefore(string $url)
Register a callback to ping a given URL before the job runs.
at line 459
$this
thenPing(string $url)
Register a callback to ping a given URL after the job runs.
at line 471
$this
runInBackground()
State that the command should run in background.
at line 484
$this
user(string $user)
Set which user the command should run as.
at line 497
$this
environments(array|mixed $environments)
Limit the environments the command should run in.
at line 509
$this
evenInMaintenanceMode()
State that the command should run even in maintenance mode.
at line 522
$this
withoutOverlapping(int $expiresAt = 1440)
Do not allow the event to overlap each other.
at line 541
$this
when(Closure $callback)
Register a callback to further filter the schedule.
at line 554
$this
skip(Closure $callback)
Register a callback to further filter the schedule.
at line 567
$this
before(Closure $callback)
Register a callback to be called before the operation.
at line 580
$this
after(Closure $callback)
Register a callback to be called after the operation.
at line 591
$this
then(Closure $callback)
Register a callback to be called after the operation.
at line 604
$this
name(string $description)
Set the human-friendly description of the event.
at line 615
$this
description(string $description)
Set the human-friendly description of the event.
at line 627
string
getSummaryForDisplay()
Get the summary of the event for display.
at line 644
Carbon
nextRunDate(DateTime|string $currentTime = 'now', int $nth = 0, bool $allowCurrentDate = false)
Determine the next due date for an event.
at line 656
string
getExpression()
Get the Cron expression for the event.
at line 667
$this
preventOverlapsUsing(Mutex $mutex)
Set the mutex implementation to be used.