class CallbackEvent extends Event (View source)

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
string|null $command

The command string.

from  Event
string $expression

The cron expression representing the event's frequency.

from  Event
int|null $repeatSeconds

How often to repeat the event during a minute.

from  Event
DateTimeZone|string $timezone

The timezone the date should be evaluated on.

from  Event
string|null $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
bool $onOneServer

Indicates if the command should only be allowed to run on one server for each cron expression.

from  Event
int $expiresAt

The number of minutes the mutex should be valid.

from  Event
bool $runInBackground

Indicates if the command should run in the 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|null $description

The human readable description of the event.

from  Event
EventMutex $mutex

The event mutex implementation.

from  Event
Closure|null $mutexNameResolver

The mutex name resolver callback.

from  Event
protected Carbon|null $lastChecked

The last time the event was checked for eligibility to run.

from  Event
int|null $exitCode

The exit status code of the command.

from  Event
protected string $callback

The callback to call.

protected array $parameters

The parameters to pass to the method.

protected mixed $result

The result of the callback's execution.

protected Throwable|null $exception

The exception that was thrown when calling the callback, if any.

Methods

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

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Checks if macro is registered.

static void
flushMacros()

Flush the existing macros.

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

Schedule the event to run every second.

$this
everyTwoSeconds()

Schedule the event to run every two seconds.

$this
everyFiveSeconds()

Schedule the event to run every five seconds.

$this
everyTenSeconds()

Schedule the event to run every ten seconds.

$this
everyFifteenSeconds()

Schedule the event to run every fifteen seconds.

$this
everyTwentySeconds()

Schedule the event to run every twenty seconds.

$this
everyThirtySeconds()

Schedule the event to run every thirty seconds.

$this
repeatEvery(int $seconds)

Schedule the event to run multiple times per minute.

$this
everyMinute()

Schedule the event to run every minute.

$this
everyTwoMinutes()

Schedule the event to run every two minutes.

$this
everyThreeMinutes()

Schedule the event to run every three minutes.

$this
everyFourMinutes()

Schedule the event to run every four minutes.

$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(array|string|int $offset)

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

$this
everyOddHour(array|string|int $offset = 0)

Schedule the event to run every odd hour.

$this
everyTwoHours(array|string|int $offset = 0)

Schedule the event to run every two hours.

$this
everyThreeHours(array|string|int $offset = 0)

Schedule the event to run every three hours.

$this
everyFourHours(array|string|int $offset = 0)

Schedule the event to run every four hours.

$this
everySixHours(array|string|int $offset = 0)

Schedule the event to run every six hours.

$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
twiceDailyAt(int $first = 1, int $second = 13, int $offset = 0)

Schedule the event to run twice daily at a given offset.

$this
hourBasedSchedule(array|string|int $minutes, array|string|int $hours)

Schedule the event to run at the given minutes and hours.

$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(array|mixed $dayOfWeek, 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 $dayOfMonth = 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, string $time = '0:0')

Schedule the event to run twice monthly at a given time.

$this
lastDayOfMonth(string $time = '0:0')

Schedule the event to run on the last day of the month.

$this
quarterly()

Schedule the event to run quarterly.

$this
quarterlyOn(int $dayOfQuarter = 1, string $time = '0:0')

Schedule the event to run quarterly on a given day and time.

$this
yearly()

Schedule the event to run yearly.

$this
yearlyOn(int $month = 1, int|string $dayOfMonth = 1, string $time = '0:0')

Schedule the event to run yearly on a given month, day, and time.

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

string
firstClosureParameterType(Closure $closure)

Get the class name of the first parameter of the given Closure.

array
firstClosureParameterTypes(Closure $closure)

Get the class names of the first parameter of the given Closure, including union types.

array
closureParameterTypes(Closure $closure)

Get the class names / types of the parameters of the given Closure.

void
__construct(EventMutex $mutex, string|callable $callback, array $parameters = [], DateTimeZone|string|null $timezone = null)

Create a new event instance.

string
getDefaultOutput()

Get the default output depending on the OS.

from  Event
void
run(Container $container)

Run the callback event.

bool
shouldSkipDueToOverlapping()

Determine if the event should skip because another process is overlapping.

bool
isRepeatable()

Determine if the event has been configured to repeat multiple times per minute.

from  Event
bool
shouldRepeatNow()

Determine if the event is ready to repeat.

from  Event
int
start(Container $container)

Run the command process.

from  Event
int
execute(Container $container)

Run the callback.

void
finish(Container $container, int $exitCode)

Mark the command process as finished and run callbacks/cleanup.

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

Ensure that the output is stored on disk in a log file.

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
$this
emailOutputOnFailure(array|mixed $addresses)

E-mail the results of the scheduled operation if it fails.

from  Event
void
ensureOutputIsBeingCaptured()

Ensure that the command output is being captured.

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
pingBeforeIf(bool $value, string $url)

Register a callback to ping a given URL before the job runs if the given condition is true.

from  Event
$this
thenPing(string $url)

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

from  Event
$this
thenPingIf(bool $value, string $url)

Register a callback to ping a given URL after the job runs if the given condition is true.

from  Event
$this
pingOnSuccess(string $url)

Register a callback to ping a given URL if the operation succeeds.

from  Event
$this
pingOnFailure(string $url)

Register a callback to ping a given URL if the operation fails.

from  Event
pingCallback(string $url)

Get the callback that pings the given URL.

from  Event
$this
runInBackground()

Indicate that the callback should run in the background.

$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
onOneServer()

Allow the event to only run on one server for each cron expression.

$this
when(Closure|bool $callback)

Register a callback to further filter the schedule.

from  Event
$this
skip(Closure|bool $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
thenWithOutput(Closure $callback, bool $onlyIfOutputExists = false)

Register a callback that uses the output after the job runs.

from  Event
$this
onSuccess(Closure $callback)

Register a callback to be called if the operation succeeds.

from  Event
$this
onSuccessWithOutput(Closure $callback, bool $onlyIfOutputExists = false)

Register a callback that uses the output if the operation succeeds.

from  Event
$this
onFailure(Closure $callback)

Register a callback to be called if the operation fails.

from  Event
$this
onFailureWithOutput(Closure $callback, bool $onlyIfOutputExists = false)

Register a callback that uses the output if the operation fails.

from  Event
withOutputCallback(Closure $callback, bool $onlyIfOutputExists = false)

Get a callback that provides output.

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.

nextRunDate(DateTimeInterface|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(EventMutex $mutex)

Set the event mutex implementation to be used.

from  Event
string
mutexName()

Get the mutex name for the scheduled command.

$this
createMutexNameUsing(Closure|string $mutexName)

Set the mutex name or name resolver callback.

from  Event
void
removeMutex()

Clear the mutex for the event.

Details

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

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

$this cron(string $expression)

The Cron expression representing the event's frequency.

Parameters

string $expression

Return Value

$this

$this between(string $startTime, string $endTime)

Schedule the event to run between start and end time.

Parameters

string $startTime
string $endTime

Return Value

$this

$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

$this everySecond()

Schedule the event to run every second.

Return Value

$this

$this everyTwoSeconds()

Schedule the event to run every two seconds.

Return Value

$this

$this everyFiveSeconds()

Schedule the event to run every five seconds.

Return Value

$this

$this everyTenSeconds()

Schedule the event to run every ten seconds.

Return Value

$this

$this everyFifteenSeconds()

Schedule the event to run every fifteen seconds.

Return Value

$this

$this everyTwentySeconds()

Schedule the event to run every twenty seconds.

Return Value

$this

$this everyThirtySeconds()

Schedule the event to run every thirty seconds.

Return Value

$this

protected $this repeatEvery(int $seconds)

Schedule the event to run multiple times per minute.

Parameters

int $seconds

Return Value

$this

$this everyMinute()

Schedule the event to run every minute.

Return Value

$this

$this everyTwoMinutes()

Schedule the event to run every two minutes.

Return Value

$this

$this everyThreeMinutes()

Schedule the event to run every three minutes.

Return Value

$this

$this everyFourMinutes()

Schedule the event to run every four minutes.

Return Value

$this

$this everyFiveMinutes()

Schedule the event to run every five minutes.

Return Value

$this

$this everyTenMinutes()

Schedule the event to run every ten minutes.

Return Value

$this

$this everyFifteenMinutes()

Schedule the event to run every fifteen minutes.

Return Value

$this

$this everyThirtyMinutes()

Schedule the event to run every thirty minutes.

Return Value

$this

$this hourly()

Schedule the event to run hourly.

Return Value

$this

$this hourlyAt(array|string|int $offset)

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

Parameters

array|string|int $offset

Return Value

$this

$this everyOddHour(array|string|int $offset = 0)

Schedule the event to run every odd hour.

Parameters

array|string|int $offset

Return Value

$this

$this everyTwoHours(array|string|int $offset = 0)

Schedule the event to run every two hours.

Parameters

array|string|int $offset

Return Value

$this

$this everyThreeHours(array|string|int $offset = 0)

Schedule the event to run every three hours.

Parameters

array|string|int $offset

Return Value

$this

$this everyFourHours(array|string|int $offset = 0)

Schedule the event to run every four hours.

Parameters

array|string|int $offset

Return Value

$this

$this everySixHours(array|string|int $offset = 0)

Schedule the event to run every six hours.

Parameters

array|string|int $offset

Return Value

$this

$this daily()

Schedule the event to run daily.

Return Value

$this

$this at(string $time)

Schedule the command at a given time.

Parameters

string $time

Return Value

$this

$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

$this twiceDaily(int $first = 1, int $second = 13)

Schedule the event to run twice daily.

Parameters

int $first
int $second

Return Value

$this

$this twiceDailyAt(int $first = 1, int $second = 13, int $offset = 0)

Schedule the event to run twice daily at a given offset.

Parameters

int $first
int $second
int $offset

Return Value

$this

protected $this hourBasedSchedule(array|string|int $minutes, array|string|int $hours)

Schedule the event to run at the given minutes and hours.

Parameters

array|string|int $minutes
array|string|int $hours

Return Value

$this

$this weekdays()

Schedule the event to run only on weekdays.

Return Value

$this

$this weekends()

Schedule the event to run only on weekends.

Return Value

$this

$this mondays()

Schedule the event to run only on Mondays.

Return Value

$this

$this tuesdays()

Schedule the event to run only on Tuesdays.

Return Value

$this

$this wednesdays()

Schedule the event to run only on Wednesdays.

Return Value

$this

$this thursdays()

Schedule the event to run only on Thursdays.

Return Value

$this

$this fridays()

Schedule the event to run only on Fridays.

Return Value

$this

$this saturdays()

Schedule the event to run only on Saturdays.

Return Value

$this

$this sundays()

Schedule the event to run only on Sundays.

Return Value

$this

$this weekly()

Schedule the event to run weekly.

Return Value

$this

$this weeklyOn(array|mixed $dayOfWeek, string $time = '0:0')

Schedule the event to run weekly on a given day and time.

Parameters

array|mixed $dayOfWeek
string $time

Return Value

$this

$this monthly()

Schedule the event to run monthly.

Return Value

$this

$this monthlyOn(int $dayOfMonth = 1, string $time = '0:0')

Schedule the event to run monthly on a given day and time.

Parameters

int $dayOfMonth
string $time

Return Value

$this

$this twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0')

Schedule the event to run twice monthly at a given time.

Parameters

int $first
int $second
string $time

Return Value

$this

$this lastDayOfMonth(string $time = '0:0')

Schedule the event to run on the last day of the month.

Parameters

string $time

Return Value

$this

$this quarterly()

Schedule the event to run quarterly.

Return Value

$this

$this quarterlyOn(int $dayOfQuarter = 1, string $time = '0:0')

Schedule the event to run quarterly on a given day and time.

Parameters

int $dayOfQuarter
string $time

Return Value

$this

$this yearly()

Schedule the event to run yearly.

Return Value

$this

$this yearlyOn(int $month = 1, int|string $dayOfMonth = 1, string $time = '0:0')

Schedule the event to run yearly on a given month, day, and time.

Parameters

int $month
int|string $dayOfMonth
string $time

Return Value

$this

$this days(array|mixed $days)

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

Parameters

array|mixed $days

Return Value

$this

$this timezone(DateTimeZone|string $timezone)

Set the timezone the date should be evaluated on.

Parameters

DateTimeZone|string $timezone

Return Value

$this

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

protected string firstClosureParameterType(Closure $closure)

Get the class name of the first parameter of the given Closure.

Parameters

Closure $closure

Return Value

string

Exceptions

ReflectionException
RuntimeException

protected array firstClosureParameterTypes(Closure $closure)

Get the class names of the first parameter of the given Closure, including union types.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException
RuntimeException

protected array closureParameterTypes(Closure $closure)

Get the class names / types of the parameters of the given Closure.

Parameters

Closure $closure

Return Value

array

Exceptions

ReflectionException

void __construct(EventMutex $mutex, string|callable $callback, array $parameters = [], DateTimeZone|string|null $timezone = null)

Create a new event instance.

Parameters

EventMutex $mutex
string|callable $callback
array $parameters
DateTimeZone|string|null $timezone

Return Value

void

Exceptions

InvalidArgumentException

string getDefaultOutput()

Get the default output depending on the OS.

Return Value

string

void run(Container $container)

Run the callback event.

Parameters

Container $container

Return Value

void

Exceptions

Throwable

bool shouldSkipDueToOverlapping()

Determine if the event should skip because another process is overlapping.

Return Value

bool

bool isRepeatable()

Determine if the event has been configured to repeat multiple times per minute.

Return Value

bool

bool shouldRepeatNow()

Determine if the event is ready to repeat.

Return Value

bool

protected int start(Container $container)

Run the command process.

Parameters

Container $container

Return Value

int

Exceptions

Throwable

protected int execute(Container $container)

Run the callback.

Parameters

Container $container

Return Value

int

void finish(Container $container, int $exitCode)

Mark the command process as finished and run callbacks/cleanup.

Parameters

Container $container
int $exitCode

Return Value

void

void callBeforeCallbacks(Container $container)

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

Parameters

Container $container

Return Value

void

void callAfterCallbacks(Container $container)

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

Parameters

Container $container

Return Value

void

string buildCommand()

Build the command string.

Return Value

string

bool isDue(Application $app)

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

Parameters

Application $app

Return Value

bool

bool runsInMaintenanceMode()

Determine if the event runs in maintenance mode.

Return Value

bool

protected bool expressionPasses()

Determine if the Cron expression passes.

Return Value

bool

bool runsInEnvironment(string $environment)

Determine if the event runs in the given environment.

Parameters

string $environment

Return Value

bool

bool filtersPass(Application $app)

Determine if the filters pass for the event.

Parameters

Application $app

Return Value

bool

$this storeOutput()

Ensure that the output is stored on disk in a log file.

Return Value

$this

$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

$this appendOutputTo(string $location)

Append the output of the command to a given location.

Parameters

string $location

Return Value

$this

$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

$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

$this emailOutputOnFailure(array|mixed $addresses)

E-mail the results of the scheduled operation if it fails.

Parameters

array|mixed $addresses

Return Value

$this

protected void ensureOutputIsBeingCaptured()

Ensure that the command output is being captured.

Return Value

void

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

protected string getEmailSubject()

Get the e-mail subject line for output results.

Return Value

string

$this pingBefore(string $url)

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

Parameters

string $url

Return Value

$this

$this pingBeforeIf(bool $value, string $url)

Register a callback to ping a given URL before the job runs if the given condition is true.

Parameters

bool $value
string $url

Return Value

$this

$this thenPing(string $url)

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

Parameters

string $url

Return Value

$this

$this thenPingIf(bool $value, string $url)

Register a callback to ping a given URL after the job runs if the given condition is true.

Parameters

bool $value
string $url

Return Value

$this

$this pingOnSuccess(string $url)

Register a callback to ping a given URL if the operation succeeds.

Parameters

string $url

Return Value

$this

$this pingOnFailure(string $url)

Register a callback to ping a given URL if the operation fails.

Parameters

string $url

Return Value

$this

protected Closure pingCallback(string $url)

Get the callback that pings the given URL.

Parameters

string $url

Return Value

Closure

$this runInBackground()

Indicate that the callback should run in the background.

Return Value

$this

Exceptions

RuntimeException

$this user(string $user)

Set which user the command should run as.

Parameters

string $user

Return Value

$this

$this environments(array|mixed $environments)

Limit the environments the command should run in.

Parameters

array|mixed $environments

Return Value

$this

$this evenInMaintenanceMode()

State that the command should run even in maintenance mode.

Return Value

$this

$this withoutOverlapping(int $expiresAt = 1440)

Do not allow the event to overlap each other.

The expiration time of the underlying cache lock may be specified in minutes.

Parameters

int $expiresAt

Return Value

$this

Exceptions

LogicException

$this onOneServer()

Allow the event to only run on one server for each cron expression.

Return Value

$this

Exceptions

LogicException

$this when(Closure|bool $callback)

Register a callback to further filter the schedule.

Parameters

Closure|bool $callback

Return Value

$this

$this skip(Closure|bool $callback)

Register a callback to further filter the schedule.

Parameters

Closure|bool $callback

Return Value

$this

$this before(Closure $callback)

Register a callback to be called before the operation.

Parameters

Closure $callback

Return Value

$this

$this after(Closure $callback)

Register a callback to be called after the operation.

Parameters

Closure $callback

Return Value

$this

$this then(Closure $callback)

Register a callback to be called after the operation.

Parameters

Closure $callback

Return Value

$this

$this thenWithOutput(Closure $callback, bool $onlyIfOutputExists = false)

Register a callback that uses the output after the job runs.

Parameters

Closure $callback
bool $onlyIfOutputExists

Return Value

$this

$this onSuccess(Closure $callback)

Register a callback to be called if the operation succeeds.

Parameters

Closure $callback

Return Value

$this

$this onSuccessWithOutput(Closure $callback, bool $onlyIfOutputExists = false)

Register a callback that uses the output if the operation succeeds.

Parameters

Closure $callback
bool $onlyIfOutputExists

Return Value

$this

$this onFailure(Closure $callback)

Register a callback to be called if the operation fails.

Parameters

Closure $callback

Return Value

$this

$this onFailureWithOutput(Closure $callback, bool $onlyIfOutputExists = false)

Register a callback that uses the output if the operation fails.

Parameters

Closure $callback
bool $onlyIfOutputExists

Return Value

$this

protected Closure withOutputCallback(Closure $callback, bool $onlyIfOutputExists = false)

Get a callback that provides output.

Parameters

Closure $callback
bool $onlyIfOutputExists

Return Value

Closure

$this name(string $description)

Set the human-friendly description of the event.

Parameters

string $description

Return Value

$this

$this description(string $description)

Set the human-friendly description of the event.

Parameters

string $description

Return Value

$this

string getSummaryForDisplay()

Get the summary of the event for display.

Return Value

string

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

Determine the next due date for an event.

Parameters

DateTimeInterface|string $currentTime
int $nth
bool $allowCurrentDate

Return Value

Carbon

string getExpression()

Get the Cron expression for the event.

Return Value

string

$this preventOverlapsUsing(EventMutex $mutex)

Set the event mutex implementation to be used.

Parameters

EventMutex $mutex

Return Value

$this

string mutexName()

Get the mutex name for the scheduled command.

Return Value

string

$this createMutexNameUsing(Closure|string $mutexName)

Set the mutex name or name resolver callback.

Parameters

Closure|string $mutexName

Return Value

$this

protected void removeMutex()

Clear the mutex for the event.

Return Value

void