class CallbackEvent extends Event

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

static void
macro(string $name, callable $macro)

Register a custom macro.

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
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
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
everyThirtyMinutes()

Schedule the event to run every thirty minutes.

$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.

$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.

string
getDefaultOutput()

Get the default output depending on the OS.

from  Event
void
run(Container $container)

Run the given event.

string
mutexName()

Get the mutex name for the scheduled command.

void
runCommandInForeground(Container $container)

Run the command in the foreground.

from  Event
void
runCommandInBackground(Container $container)

Run the command in the background.

from  Event
void
callBeforeCallbacks(Container $container)

Call all of the "before" callbacks for the event.

from  Event
void
callAfterCallbacks(Container $container)

Call all of the "after" callbacks for the event.

from  Event
string
buildCommand()

Build the command string.

from  Event
bool
isDue(Application $app)

Determine if the given event should run based on the Cron expression.

from  Event
bool
runsInMaintenanceMode()

Determine if the event runs in maintenance mode.

from  Event
bool
expressionPasses()

Determine if the Cron expression passes.

from  Event
bool
runsInEnvironment(string $environment)

Determine if the event runs in the given environment.

from  Event
bool
filtersPass(Application $app)

Determine if the filters pass for the event.

from  Event
$this
sendOutputTo(string $location, bool $append = false)

Send the output of the command to a given location.

from  Event
$this
appendOutputTo(string $location)

Append the output of the command to a given location.

from  Event
$this
emailOutputTo(array|mixed $addresses, bool $onlyIfOutputExists = false)

E-mail the results of the scheduled operation.

from  Event
$this
emailWrittenOutputTo(array|mixed $addresses)

E-mail the results of the scheduled operation if it produces output.

from  Event
void
ensureOutputIsBeingCapturedForEmail()

Ensure that output is being captured for email.

from  Event
void
emailOutput(Mailer $mailer, array $addresses, bool $onlyIfOutputExists = false)

E-mail the output of the event to the recipients.

from  Event
string
getEmailSubject()

Get the e-mail subject line for output results.

from  Event
$this
pingBefore(string $url)

Register a callback to ping a given URL before the job runs.

from  Event
$this
thenPing(string $url)

Register a callback to ping a given URL after the job runs.

from  Event
$this
runInBackground()

State that the command should run in background.

from  Event
$this
user(string $user)

Set which user the command should run as.

from  Event
$this
environments(array|mixed $environments)

Limit the environments the command should run in.

from  Event
$this
evenInMaintenanceMode()

State that the command should run even in maintenance mode.

from  Event
$this
withoutOverlapping(int $expiresAt = 1440)

Do not allow the event to overlap each other.

$this
when(Closure $callback)

Register a callback to further filter the schedule.

from  Event
$this
skip(Closure $callback)

Register a callback to further filter the schedule.

from  Event
$this
before(Closure $callback)

Register a callback to be called before the operation.

from  Event
$this
after(Closure $callback)

Register a callback to be called after the operation.

from  Event
$this
then(Closure $callback)

Register a callback to be called after the operation.

from  Event
$this
name(string $description)

Set the human-friendly description of the event.

from  Event
$this
description(string $description)

Set the human-friendly description of the event.

from  Event
string
getSummaryForDisplay()

Get the summary of the event for display.

Carbon
nextRunDate(DateTime|string $currentTime = 'now', int $nth = 0, bool $allowCurrentDate = false)

Determine the next due date for an event.

from  Event
string
getExpression()

Get the Cron expression for the event.

from  Event
$this
preventOverlapsUsing(Mutex $mutex)

Set the mutex implementation to be used.

from  Event
void
removeMutex()

Clear the mutex for the event.

Details

in Macroable at line 24
static void macro(string $name, callable $macro)

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

in Macroable at line 35
static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 49
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 71
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in ManagesFrequencies at line 15
$this cron(string $expression)

The Cron expression representing the event's frequency.

Parameters

string $expression

Return Value

$this

in ManagesFrequencies at line 29
$this between(string $startTime, string $endTime)

Schedule the event to run between start and end time.

Parameters

string $startTime
string $endTime

Return Value

$this

in ManagesFrequencies at line 41
$this unlessBetween(string $startTime, string $endTime)

Schedule the event to not run between start and end time.

Parameters

string $startTime
string $endTime

Return Value

$this

in ManagesFrequencies at line 69
$this hourly()

Schedule the event to run hourly.

Return Value

$this

in ManagesFrequencies at line 80
$this hourlyAt(int $offset)

Schedule the event to run hourly at a given offset in the hour.

Parameters

int $offset

Return Value

$this

in ManagesFrequencies at line 90
$this daily()

Schedule the event to run daily.

Return Value

$this

in ManagesFrequencies at line 102
$this at(string $time)

Schedule the command at a given time.

Parameters

string $time

Return Value

$this

in ManagesFrequencies at line 113
$this dailyAt(string $time)

Schedule the event to run daily at a given time (10:00, 19:30, etc).

Parameters

string $time

Return Value

$this

in ManagesFrequencies at line 128
$this twiceDaily(int $first = 1, int $second = 13)

Schedule the event to run twice daily.

Parameters

int $first
int $second

Return Value

$this

in ManagesFrequencies at line 141
$this weekdays()

Schedule the event to run only on weekdays.

Return Value

$this

in ManagesFrequencies at line 151
$this weekends()

Schedule the event to run only on weekends.

Return Value

$this

in ManagesFrequencies at line 161
$this mondays()

Schedule the event to run only on Mondays.

Return Value

$this

in ManagesFrequencies at line 171
$this tuesdays()

Schedule the event to run only on Tuesdays.

Return Value

$this

in ManagesFrequencies at line 181
$this wednesdays()

Schedule the event to run only on Wednesdays.

Return Value

$this

in ManagesFrequencies at line 191
$this thursdays()

Schedule the event to run only on Thursdays.

Return Value

$this

in ManagesFrequencies at line 201
$this fridays()

Schedule the event to run only on Fridays.

Return Value

$this

in ManagesFrequencies at line 211
$this saturdays()

Schedule the event to run only on Saturdays.

Return Value

$this

in ManagesFrequencies at line 221
$this sundays()

Schedule the event to run only on Sundays.

Return Value

$this

in ManagesFrequencies at line 231
$this weekly()

Schedule the event to run weekly.

Return Value

$this

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.

Parameters

int $day
string $time

Return Value

$this

in ManagesFrequencies at line 257
$this monthly()

Schedule the event to run monthly.

Return Value

$this

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.

Parameters

int $day
string $time

Return Value

$this

in ManagesFrequencies at line 285
$this twiceMonthly(int $first = 1, int $second = 16)

Schedule the event to run twice monthly.

Parameters

int $first
int $second

Return Value

$this

in ManagesFrequencies at line 299
$this quarterly()

Schedule the event to run quarterly.

Return Value

$this

in ManagesFrequencies at line 312
$this yearly()

Schedule the event to run yearly.

Return Value

$this

in ManagesFrequencies at line 325
$this everyMinute()

Schedule the event to run every minute.

Return Value

$this

in ManagesFrequencies at line 335
$this everyFiveMinutes()

Schedule the event to run every five minutes.

Return Value

$this

in ManagesFrequencies at line 345
$this everyTenMinutes()

Schedule the event to run every ten minutes.

Return Value

$this

in ManagesFrequencies at line 355
$this everyThirtyMinutes()

Schedule the event to run every thirty minutes.

Return Value

$this

in ManagesFrequencies at line 366
$this days(array|mixed $days)

Set the days of the week the command should run on.

Parameters

array|mixed $days

Return Value

$this

in ManagesFrequencies at line 379
$this timezone(DateTimeZone|string $timezone)

Set the timezone the date should be evaluated on.

Parameters

DateTimeZone|string $timezone

Return Value

$this

in ManagesFrequencies at line 393
protected $this spliceIntoPosition(int $position, string $value)

Splice the given value into the given position of the expression.

Parameters

int $position
string $value

Return Value

$this

at line 35
void __construct(Mutex $mutex, string $callback, array $parameters = [])

Create a new event instance.

Parameters

Mutex $mutex
string $callback
array $parameters

Return Value

void

Exceptions

InvalidArgumentException

in Event at line 156
string getDefaultOutput()

Get the default output depending on the OS.

Return Value

string

at line 56
void run(Container $container)

Run the given event.

Parameters

Container $container

Return Value

void

Exceptions

Exception

at line 118
string mutexName()

Get the mutex name for the scheduled command.

Return Value

string

in Event at line 195
protected void runCommandInForeground(Container $container)

Run the command in the foreground.

Parameters

Container $container

Return Value

void

in Event at line 212
protected void runCommandInBackground(Container $container)

Run the command in the background.

Parameters

Container $container

Return Value

void

in Event at line 227
void callBeforeCallbacks(Container $container)

Call all of the "before" callbacks for the event.

Parameters

Container $container

Return Value

void

in Event at line 240
void callAfterCallbacks(Container $container)

Call all of the "after" callbacks for the event.

Parameters

Container $container

Return Value

void

in Event at line 252
string buildCommand()

Build the command string.

Return Value

string

in Event at line 263
bool isDue(Application $app)

Determine if the given event should run based on the Cron expression.

Parameters

Application $app

Return Value

bool

in Event at line 278
bool runsInMaintenanceMode()

Determine if the event runs in maintenance mode.

Return Value

bool

in Event at line 288
protected bool expressionPasses()

Determine if the Cron expression passes.

Return Value

bool

in Event at line 305
bool runsInEnvironment(string $environment)

Determine if the event runs in the given environment.

Parameters

string $environment

Return Value

bool

in Event at line 316
bool filtersPass(Application $app)

Determine if the filters pass for the event.

Parameters

Application $app

Return Value

bool

in Event at line 340
$this sendOutputTo(string $location, bool $append = false)

Send the output of the command to a given location.

Parameters

string $location
bool $append

Return Value

$this

in Event at line 355
$this appendOutputTo(string $location)

Append the output of the command to a given location.

Parameters

string $location

Return Value

$this

in Event at line 369
$this emailOutputTo(array|mixed $addresses, bool $onlyIfOutputExists = false)

E-mail the results of the scheduled operation.

Parameters

array|mixed $addresses
bool $onlyIfOutputExists

Return Value

$this

Exceptions

LogicException

in Event at line 388
$this emailWrittenOutputTo(array|mixed $addresses)

E-mail the results of the scheduled operation if it produces output.

Parameters

array|mixed $addresses

Return Value

$this

Exceptions

LogicException

in Event at line 398
protected void ensureOutputIsBeingCapturedForEmail()

Ensure that output is being captured for email.

Return Value

void

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.

Parameters

Mailer $mailer
array $addresses
bool $onlyIfOutputExists

Return Value

void

in Event at line 431
protected string getEmailSubject()

Get the e-mail subject line for output results.

Return Value

string

in Event at line 446
$this pingBefore(string $url)

Register a callback to ping a given URL before the job runs.

Parameters

string $url

Return Value

$this

in Event at line 459
$this thenPing(string $url)

Register a callback to ping a given URL after the job runs.

Parameters

string $url

Return Value

$this

in Event at line 471
$this runInBackground()

State that the command should run in background.

Return Value

$this

in Event at line 484
$this user(string $user)

Set which user the command should run as.

Parameters

string $user

Return Value

$this

in Event at line 497
$this environments(array|mixed $environments)

Limit the environments the command should run in.

Parameters

array|mixed $environments

Return Value

$this

in Event at line 509
$this evenInMaintenanceMode()

State that the command should run even in maintenance mode.

Return Value

$this

at line 96
$this withoutOverlapping(int $expiresAt = 1440)

Do not allow the event to overlap each other.

Parameters

int $expiresAt

Return Value

$this

in Event at line 541
$this when(Closure $callback)

Register a callback to further filter the schedule.

Parameters

Closure $callback

Return Value

$this

in Event at line 554
$this skip(Closure $callback)

Register a callback to further filter the schedule.

Parameters

Closure $callback

Return Value

$this

in Event at line 567
$this before(Closure $callback)

Register a callback to be called before the operation.

Parameters

Closure $callback

Return Value

$this

in Event at line 580
$this after(Closure $callback)

Register a callback to be called after the operation.

Parameters

Closure $callback

Return Value

$this

in Event at line 591
$this then(Closure $callback)

Register a callback to be called after the operation.

Parameters

Closure $callback

Return Value

$this

in Event at line 604
$this name(string $description)

Set the human-friendly description of the event.

Parameters

string $description

Return Value

$this

in Event at line 615
$this description(string $description)

Set the human-friendly description of the event.

Parameters

string $description

Return Value

$this

at line 128
string getSummaryForDisplay()

Get the summary of the event for display.

Return Value

string

in Event at line 644
Carbon nextRunDate(DateTime|string $currentTime = 'now', int $nth = 0, bool $allowCurrentDate = false)

Determine the next due date for an event.

Parameters

DateTime|string $currentTime
int $nth
bool $allowCurrentDate

Return Value

Carbon

in Event at line 656
string getExpression()

Get the Cron expression for the event.

Return Value

string

in Event at line 667
$this preventOverlapsUsing(Mutex $mutex)

Set the mutex implementation to be used.

Parameters

Mutex $mutex

Return Value

$this

at line 83
protected void removeMutex()

Clear the mutex for the event.

Return Value

void