CallbackEvent
extends Event
in package
Table of Contents
- $command : string
- The command string.
- $description : string
- The human readable description of the event.
- $environments : array<string|int, mixed>
- The list of environments the command should run under.
- $evenInMaintenanceMode : bool
- Indicates if the command should run in maintenance mode.
- $expiresAt : int
- The amount of time the mutex should be valid.
- $expression : string
- The cron expression representing the event's frequency.
- $mutex : Mutex
- The mutex implementation.
- $output : string
- The location that output should be sent to.
- $runInBackground : bool
- Indicates if the command should run in background.
- $shouldAppendOutput : bool
- Indicates whether output should be appended.
- $timezone : DateTimeZone|string
- The timezone the date should be evaluated on.
- $user : string
- The user the command should run as.
- $withoutOverlapping : bool
- Indicates if the command should not overlap itself.
- $afterCallbacks : array<string|int, mixed>
- The array of callbacks to be run after the event is finished.
- $beforeCallbacks : array<string|int, mixed>
- The array of callbacks to be run before the event is started.
- $callback : string
- The callback to call.
- $filters : array<string|int, mixed>
- The array of filter callbacks.
- $macros : array<string|int, mixed>
- The registered string macros.
- $parameters : array<string|int, mixed>
- The parameters to pass to the method.
- $rejects : array<string|int, mixed>
- The array of reject callbacks.
- __call() : mixed
- Dynamically handle calls to the class.
- __callStatic() : mixed
- Dynamically handle calls to the class.
- __construct() : void
- Create a new event instance.
- after() : $this
- Register a callback to be called after the operation.
- appendOutputTo() : $this
- Append the output of the command to a given location.
- at() : $this
- Schedule the command at a given time.
- before() : $this
- Register a callback to be called before the operation.
- between() : $this
- Schedule the event to run between start and end time.
- buildCommand() : string
- Build the command string.
- callAfterCallbacks() : void
- Call all of the "after" callbacks for the event.
- callBeforeCallbacks() : void
- Call all of the "before" callbacks for the event.
- cron() : $this
- The Cron expression representing the event's frequency.
- daily() : $this
- Schedule the event to run daily.
- dailyAt() : $this
- Schedule the event to run daily at a given time (10:00, 19:30, etc).
- days() : $this
- Set the days of the week the command should run on.
- description() : $this
- Set the human-friendly description of the event.
- emailOutputTo() : $this
- E-mail the results of the scheduled operation.
- emailWrittenOutputTo() : $this
- E-mail the results of the scheduled operation if it produces output.
- environments() : $this
- Limit the environments the command should run in.
- evenInMaintenanceMode() : $this
- State that the command should run even in maintenance mode.
- everyFifteenMinutes() : $this
- Schedule the event to run every fifteen minutes.
- everyFiveMinutes() : $this
- Schedule the event to run every five minutes.
- everyMinute() : $this
- Schedule the event to run every minute.
- everyTenMinutes() : $this
- Schedule the event to run every ten minutes.
- everyThirtyMinutes() : $this
- Schedule the event to run every thirty minutes.
- filtersPass() : bool
- Determine if the filters pass for the event.
- fridays() : $this
- Schedule the event to run only on Fridays.
- getDefaultOutput() : string
- Get the default output depending on the OS.
- getExpression() : string
- Get the Cron expression for the event.
- getSummaryForDisplay() : string
- Get the summary of the event for display.
- hasMacro() : bool
- Checks if macro is registered.
- hourly() : $this
- Schedule the event to run hourly.
- hourlyAt() : $this
- Schedule the event to run hourly at a given offset in the hour.
- isDue() : bool
- Determine if the given event should run based on the Cron expression.
- macro() : void
- Register a custom macro.
- mixin() : void
- Mix another object into the class.
- mondays() : $this
- Schedule the event to run only on Mondays.
- monthly() : $this
- Schedule the event to run monthly.
- monthlyOn() : $this
- Schedule the event to run monthly on a given day and time.
- mutexName() : string
- Get the mutex name for the scheduled command.
- name() : $this
- Set the human-friendly description of the event.
- nextRunDate() : Carbon
- Determine the next due date for an event.
- pingBefore() : $this
- Register a callback to ping a given URL before the job runs.
- preventOverlapsUsing() : $this
- Set the mutex implementation to be used.
- quarterly() : $this
- Schedule the event to run quarterly.
- run() : mixed
- Run the given event.
- runInBackground() : $this
- State that the command should run in background.
- runsInEnvironment() : bool
- Determine if the event runs in the given environment.
- runsInMaintenanceMode() : bool
- Determine if the event runs in maintenance mode.
- saturdays() : $this
- Schedule the event to run only on Saturdays.
- sendOutputTo() : $this
- Send the output of the command to a given location.
- skip() : $this
- Register a callback to further filter the schedule.
- sundays() : $this
- Schedule the event to run only on Sundays.
- then() : $this
- Register a callback to be called after the operation.
- thenPing() : $this
- Register a callback to ping a given URL after the job runs.
- thursdays() : $this
- Schedule the event to run only on Thursdays.
- timezone() : $this
- Set the timezone the date should be evaluated on.
- tuesdays() : $this
- Schedule the event to run only on Tuesdays.
- twiceDaily() : $this
- Schedule the event to run twice daily.
- twiceMonthly() : $this
- Schedule the event to run twice monthly.
- unlessBetween() : $this
- Schedule the event to not run between start and end time.
- user() : $this
- Set which user the command should run as.
- wednesdays() : $this
- Schedule the event to run only on Wednesdays.
- weekdays() : $this
- Schedule the event to run only on weekdays.
- weekends() : $this
- Schedule the event to run only on weekends.
- weekly() : $this
- Schedule the event to run weekly.
- weeklyOn() : $this
- Schedule the event to run weekly on a given day and time.
- when() : $this
- Register a callback to further filter the schedule.
- withoutOverlapping() : $this
- Do not allow the event to overlap each other.
- yearly() : $this
- Schedule the event to run yearly.
- emailOutput() : void
- E-mail the output of the event to the recipients.
- ensureOutputIsBeingCapturedForEmail() : void
- Ensure that output is being captured for email.
- expressionPasses() : bool
- Determine if the Cron expression passes.
- getEmailSubject() : string
- Get the e-mail subject line for output results.
- removeMutex() : void
- Clear the mutex for the event.
- runCommandInBackground() : void
- Run the command in the background.
- runCommandInForeground() : void
- Run the command in the foreground.
- spliceIntoPosition() : $this
- Splice the given value into the given position of the expression.
- inTimeInterval() : Closure
- Schedule the event to run between start and end time.
Properties
$command
The command string.
public
string
$command
$description
The human readable description of the event.
public
string
$description
$environments
The list of environments the command should run under.
public
array<string|int, mixed>
$environments
= []
$evenInMaintenanceMode
Indicates if the command should run in maintenance mode.
public
bool
$evenInMaintenanceMode
= false
$expiresAt
The amount of time the mutex should be valid.
public
int
$expiresAt
= 1440
$expression
The cron expression representing the event's frequency.
public
string
$expression
= '* * * * * *'
$mutex
The mutex implementation.
public
Mutex
$mutex
$output
The location that output should be sent to.
public
string
$output
= '/dev/null'
$runInBackground
Indicates if the command should run in background.
public
bool
$runInBackground
= false
$shouldAppendOutput
Indicates whether output should be appended.
public
bool
$shouldAppendOutput
= false
$timezone
The timezone the date should be evaluated on.
public
DateTimeZone|string
$timezone
$user
The user the command should run as.
public
string
$user
$withoutOverlapping
Indicates if the command should not overlap itself.
public
bool
$withoutOverlapping
= false
$afterCallbacks
The array of callbacks to be run after the event is finished.
protected
array<string|int, mixed>
$afterCallbacks
= []
$beforeCallbacks
The array of callbacks to be run before the event is started.
protected
array<string|int, mixed>
$beforeCallbacks
= []
$callback
The callback to call.
protected
string
$callback
$filters
The array of filter callbacks.
protected
array<string|int, mixed>
$filters
= []
$macros
The registered string macros.
protected
static array<string|int, mixed>
$macros
= []
$parameters
The parameters to pass to the method.
protected
array<string|int, mixed>
$parameters
$rejects
The array of reject callbacks.
protected
array<string|int, mixed>
$rejects
= []
Methods
__call()
Dynamically handle calls to the class.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__callStatic()
Dynamically handle calls to the class.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
Tags
Return values
mixed —__construct()
Create a new event instance.
public
__construct(Mutex $mutex, string $callback[, array<string|int, mixed> $parameters = [] ]) : void
Parameters
- $mutex : Mutex
- $callback : string
- $parameters : array<string|int, mixed> = []
Tags
Return values
void —after()
Register a callback to be called after the operation.
public
after(Closure $callback) : $this
Parameters
- $callback : Closure
Return values
$this —appendOutputTo()
Append the output of the command to a given location.
public
appendOutputTo(string $location) : $this
Parameters
- $location : string
Return values
$this —at()
Schedule the command at a given time.
public
at(string $time) : $this
Parameters
- $time : string
Return values
$this —before()
Register a callback to be called before the operation.
public
before(Closure $callback) : $this
Parameters
- $callback : Closure
Return values
$this —between()
Schedule the event to run between start and end time.
public
between(string $startTime, string $endTime) : $this
Parameters
- $startTime : string
- $endTime : string
Return values
$this —buildCommand()
Build the command string.
public
buildCommand() : string
Return values
string —callAfterCallbacks()
Call all of the "after" callbacks for the event.
public
callAfterCallbacks(Container $container) : void
Parameters
- $container : Container
Return values
void —callBeforeCallbacks()
Call all of the "before" callbacks for the event.
public
callBeforeCallbacks(Container $container) : void
Parameters
- $container : Container
Return values
void —cron()
The Cron expression representing the event's frequency.
public
cron(string $expression) : $this
Parameters
- $expression : string
Return values
$this —daily()
Schedule the event to run daily.
public
daily() : $this
Return values
$this —dailyAt()
Schedule the event to run daily at a given time (10:00, 19:30, etc).
public
dailyAt(string $time) : $this
Parameters
- $time : string
Return values
$this —days()
Set the days of the week the command should run on.
public
days(array<string|int, mixed>|mixed $days) : $this
Parameters
- $days : array<string|int, mixed>|mixed
Return values
$this —description()
Set the human-friendly description of the event.
public
description(string $description) : $this
Parameters
- $description : string
Return values
$this —emailOutputTo()
E-mail the results of the scheduled operation.
public
emailOutputTo(array<string|int, mixed>|mixed $addresses[, bool $onlyIfOutputExists = false ]) : $this
Parameters
- $addresses : array<string|int, mixed>|mixed
- $onlyIfOutputExists : bool = false
Tags
Return values
$this —emailWrittenOutputTo()
E-mail the results of the scheduled operation if it produces output.
public
emailWrittenOutputTo(array<string|int, mixed>|mixed $addresses) : $this
Parameters
- $addresses : array<string|int, mixed>|mixed
Tags
Return values
$this —environments()
Limit the environments the command should run in.
public
environments(array<string|int, mixed>|mixed $environments) : $this
Parameters
- $environments : array<string|int, mixed>|mixed
Return values
$this —evenInMaintenanceMode()
State that the command should run even in maintenance mode.
public
evenInMaintenanceMode() : $this
Return values
$this —everyFifteenMinutes()
Schedule the event to run every fifteen minutes.
public
everyFifteenMinutes() : $this
Return values
$this —everyFiveMinutes()
Schedule the event to run every five minutes.
public
everyFiveMinutes() : $this
Return values
$this —everyMinute()
Schedule the event to run every minute.
public
everyMinute() : $this
Return values
$this —everyTenMinutes()
Schedule the event to run every ten minutes.
public
everyTenMinutes() : $this
Return values
$this —everyThirtyMinutes()
Schedule the event to run every thirty minutes.
public
everyThirtyMinutes() : $this
Return values
$this —filtersPass()
Determine if the filters pass for the event.
public
filtersPass(Application $app) : bool
Parameters
- $app : Application
Return values
bool —fridays()
Schedule the event to run only on Fridays.
public
fridays() : $this
Return values
$this —getDefaultOutput()
Get the default output depending on the OS.
public
getDefaultOutput() : string
Return values
string —getExpression()
Get the Cron expression for the event.
public
getExpression() : string
Return values
string —getSummaryForDisplay()
Get the summary of the event for display.
public
getSummaryForDisplay() : string
Return values
string —hasMacro()
Checks if macro is registered.
public
static hasMacro(string $name) : bool
Parameters
- $name : string
Return values
bool —hourly()
Schedule the event to run hourly.
public
hourly() : $this
Return values
$this —hourlyAt()
Schedule the event to run hourly at a given offset in the hour.
public
hourlyAt(int $offset) : $this
Parameters
- $offset : int
Return values
$this —isDue()
Determine if the given event should run based on the Cron expression.
public
isDue(Application $app) : bool
Parameters
- $app : Application
Return values
bool —macro()
Register a custom macro.
public
static macro(string $name, object|callable $macro) : void
Parameters
- $name : string
- $macro : object|callable
Return values
void —mixin()
Mix another object into the class.
public
static mixin(object $mixin) : void
Parameters
- $mixin : object
Return values
void —mondays()
Schedule the event to run only on Mondays.
public
mondays() : $this
Return values
$this —monthly()
Schedule the event to run monthly.
public
monthly() : $this
Return values
$this —monthlyOn()
Schedule the event to run monthly on a given day and time.
public
monthlyOn([int $day = 1 ][, string $time = '0:0' ]) : $this
Parameters
- $day : int = 1
- $time : string = '0:0'
Return values
$this —mutexName()
Get the mutex name for the scheduled command.
public
mutexName() : string
Return values
string —name()
Set the human-friendly description of the event.
public
name(string $description) : $this
Parameters
- $description : string
Return values
$this —nextRunDate()
Determine the next due date for an event.
public
nextRunDate([DateTime|string $currentTime = 'now' ], int $nth[, bool $allowCurrentDate = false ]) : Carbon
Parameters
- $currentTime : DateTime|string = 'now'
- $nth : int
- $allowCurrentDate : bool = false
Return values
Carbon —pingBefore()
Register a callback to ping a given URL before the job runs.
public
pingBefore(string $url) : $this
Parameters
- $url : string
Return values
$this —preventOverlapsUsing()
Set the mutex implementation to be used.
public
preventOverlapsUsing(Mutex $mutex) : $this
Parameters
- $mutex : Mutex
Return values
$this —quarterly()
Schedule the event to run quarterly.
public
quarterly() : $this
Return values
$this —run()
Run the given event.
public
run(Container $container) : mixed
Parameters
- $container : Container
Tags
Return values
mixed —runInBackground()
State that the command should run in background.
public
runInBackground() : $this
Return values
$this —runsInEnvironment()
Determine if the event runs in the given environment.
public
runsInEnvironment(string $environment) : bool
Parameters
- $environment : string
Return values
bool —runsInMaintenanceMode()
Determine if the event runs in maintenance mode.
public
runsInMaintenanceMode() : bool
Return values
bool —saturdays()
Schedule the event to run only on Saturdays.
public
saturdays() : $this
Return values
$this —sendOutputTo()
Send the output of the command to a given location.
public
sendOutputTo(string $location[, bool $append = false ]) : $this
Parameters
- $location : string
- $append : bool = false
Return values
$this —skip()
Register a callback to further filter the schedule.
public
skip(Closure|bool $callback) : $this
Parameters
- $callback : Closure|bool
Return values
$this —sundays()
Schedule the event to run only on Sundays.
public
sundays() : $this
Return values
$this —then()
Register a callback to be called after the operation.
public
then(Closure $callback) : $this
Parameters
- $callback : Closure
Return values
$this —thenPing()
Register a callback to ping a given URL after the job runs.
public
thenPing(string $url) : $this
Parameters
- $url : string
Return values
$this —thursdays()
Schedule the event to run only on Thursdays.
public
thursdays() : $this
Return values
$this —timezone()
Set the timezone the date should be evaluated on.
public
timezone(DateTimeZone|string $timezone) : $this
Parameters
- $timezone : DateTimeZone|string
Return values
$this —tuesdays()
Schedule the event to run only on Tuesdays.
public
tuesdays() : $this
Return values
$this —twiceDaily()
Schedule the event to run twice daily.
public
twiceDaily([int $first = 1 ][, int $second = 13 ]) : $this
Parameters
- $first : int = 1
- $second : int = 13
Return values
$this —twiceMonthly()
Schedule the event to run twice monthly.
public
twiceMonthly([int $first = 1 ][, int $second = 16 ]) : $this
Parameters
- $first : int = 1
- $second : int = 16
Return values
$this —unlessBetween()
Schedule the event to not run between start and end time.
public
unlessBetween(string $startTime, string $endTime) : $this
Parameters
- $startTime : string
- $endTime : string
Return values
$this —user()
Set which user the command should run as.
public
user(string $user) : $this
Parameters
- $user : string
Return values
$this —wednesdays()
Schedule the event to run only on Wednesdays.
public
wednesdays() : $this
Return values
$this —weekdays()
Schedule the event to run only on weekdays.
public
weekdays() : $this
Return values
$this —weekends()
Schedule the event to run only on weekends.
public
weekends() : $this
Return values
$this —weekly()
Schedule the event to run weekly.
public
weekly() : $this
Return values
$this —weeklyOn()
Schedule the event to run weekly on a given day and time.
public
weeklyOn(int $day[, string $time = '0:0' ]) : $this
Parameters
- $day : int
- $time : string = '0:0'
Return values
$this —when()
Register a callback to further filter the schedule.
public
when(Closure|bool $callback) : $this
Parameters
- $callback : Closure|bool
Return values
$this —withoutOverlapping()
Do not allow the event to overlap each other.
public
withoutOverlapping([int $expiresAt = 1440 ]) : $this
Parameters
- $expiresAt : int = 1440
Return values
$this —yearly()
Schedule the event to run yearly.
public
yearly() : $this
Return values
$this —emailOutput()
E-mail the output of the event to the recipients.
protected
emailOutput(Mailer $mailer, array<string|int, mixed> $addresses[, bool $onlyIfOutputExists = false ]) : void
Parameters
- $mailer : Mailer
- $addresses : array<string|int, mixed>
- $onlyIfOutputExists : bool = false
Return values
void —ensureOutputIsBeingCapturedForEmail()
Ensure that output is being captured for email.
protected
ensureOutputIsBeingCapturedForEmail() : void
Return values
void —expressionPasses()
Determine if the Cron expression passes.
protected
expressionPasses() : bool
Return values
bool —getEmailSubject()
Get the e-mail subject line for output results.
protected
getEmailSubject() : string
Return values
string —removeMutex()
Clear the mutex for the event.
protected
removeMutex() : void
Return values
void —runCommandInBackground()
Run the command in the background.
protected
runCommandInBackground(Container $container) : void
Parameters
- $container : Container
Return values
void —runCommandInForeground()
Run the command in the foreground.
protected
runCommandInForeground(Container $container) : void
Parameters
- $container : Container
Return values
void —spliceIntoPosition()
Splice the given value into the given position of the expression.
protected
spliceIntoPosition(int $position, string $value) : $this
Parameters
- $position : int
- $value : string
Return values
$this —inTimeInterval()
Schedule the event to run between start and end time.
private
inTimeInterval(string $startTime, string $endTime) : Closure
Parameters
- $startTime : string
- $endTime : string