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