You are viewing an older version of the documentation. For the latest, please visit master documentation.

Event

Uses

Properties

public

$command string

The command string.

Default: null
public

$expression string

The cron expression representing the event's frequency.

Default: '* * * * *'
public

$timezone DateTimeZone |string

The timezone the date should be evaluated on.

Default: null
public

$user string

The user the command should run as.

Default: null
public

$environments array

The list of environments the command should run under.

Default: []
public

$evenInMaintenanceMode bool

Indicates if the command should run in maintenance mode.

Default: false
public

$withoutOverlapping bool

Indicates if the command should not overlap itself.

Default: false
public

$onOneServer bool

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

Default: false
public

$expiresAt int

The amount of time the mutex should be valid.

Default: 1440
public

$runInBackground bool

Indicates if the command should run in the background.

Default: false
protected

$filters array

The array of filter callbacks.

Default: []
protected

$rejects array

The array of reject callbacks.

Default: []
public

$output string

The location that output should be sent to.

Default: '/dev/null'
public

$shouldAppendOutput bool

Indicates whether output should be appended.

Default: false
protected

$beforeCallbacks array

The array of callbacks to be run before the event is started.

Default: []
protected

$afterCallbacks array

The array of callbacks to be run after the event is finished.

Default: []
public

$description string

The human readable description of the event.

Default: null
public

$mutex EventMutex

The event mutex implementation.

Default: null
public

$exitCode int|null

The exit status code of the command.

Default: null

Methods

public

__construct ( EventMutex $mutex , $command , $timezone ) : void

Create a new event instance.

Parameters

public

getDefaultOutput ( ) : string

Get the default output depending on the OS.

public

run ( Container $container ) : void

Run the given event.

Parameters

public

mutexName ( ) : string

Get the mutex name for the scheduled command.

protected

runCommandInForeground ( Container $container ) : void

Run the command in the foreground.

Parameters

protected

runCommandInBackground ( Container $container ) : void

Run the command in the background.

Parameters

public

callBeforeCallbacks ( Container $container ) : void

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

Parameters

public

callAfterCallbacks ( Container $container ) : void

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

Parameters

public

callAfterCallbacksWithExitCode ( Container $container , $exitCode ) : void

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

Parameters

public

buildCommand ( ) : string

Build the command string.

public

isDue ( $app ) : bool

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

Parameters

public

runsInMaintenanceMode ( ) : bool

Determine if the event runs in maintenance mode.

protected

expressionPasses ( ) : bool

Determine if the Cron expression passes.

public

runsInEnvironment ( $environment ) : bool

Determine if the event runs in the given environment.

Parameters

  • $environment string
public

filtersPass ( $app ) : bool

Determine if the filters pass for the event.

Parameters

public

storeOutput ( ) : $this

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

public

sendOutputTo ( $location , $append ) : $this

Send the output of the command to a given location.

Parameters

  • $location string
  • $append bool
public

appendOutputTo ( $location ) : $this

Append the output of the command to a given location.

Parameters

  • $location string
public

emailOutputTo ( $addresses , $onlyIfOutputExists ) : $this

E-mail the results of the scheduled operation.

Parameters

  • $addresses array|mixed
  • $onlyIfOutputExists bool
public

emailWrittenOutputTo ( $addresses ) : $this

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

Parameters

  • $addresses array|mixed
public

emailOutputOnFailure ( $addresses ) : $this

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

Parameters

  • $addresses array|mixed
protected

ensureOutputIsBeingCaptured ( ) : void

Ensure that the command output is being captured.

protected

emailOutput ( Mailer $mailer , $addresses , $onlyIfOutputExists ) : void

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

Parameters

  • $mailer Mailer
  • $addresses array
  • $onlyIfOutputExists bool
protected

getEmailSubject ( ) : string

Get the e-mail subject line for output results.

public

pingBefore ( $url ) : $this

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

Parameters

  • $url string
public

pingBeforeIf ( $value , $url ) : $this

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

Parameters

  • $value bool
  • $url string
public

thenPing ( $url ) : $this

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

Parameters

  • $url string
public

thenPingIf ( $value , $url ) : $this

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

Parameters

  • $value bool
  • $url string
public

pingOnSuccess ( $url ) : $this

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

Parameters

  • $url string
public

pingOnFailure ( $url ) : $this

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

Parameters

  • $url string
protected

pingCallback ( $url ) : Closure

Get the callback that pings the given URL.

Parameters

  • $url string
public

runInBackground ( ) : $this

State that the command should run in the background.

public

user ( $user ) : $this

Set which user the command should run as.

Parameters

  • $user string
public

environments ( $environments ) : $this

Limit the environments the command should run in.

Parameters

  • $environments array|mixed
public

evenInMaintenanceMode ( ) : $this

State that the command should run even in maintenance mode.

public

withoutOverlapping ( $expiresAt ) : $this

Do not allow the event to overlap each other.

Parameters

  • $expiresAt int
public

onOneServer ( ) : $this

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

public

when ( $callback ) : $this

Register a callback to further filter the schedule.

Parameters

public

skip ( $callback ) : $this

Register a callback to further filter the schedule.

Parameters

public

before ( Closure $callback ) : $this

Register a callback to be called before the operation.

Parameters

public

after ( Closure $callback ) : $this

Register a callback to be called after the operation.

Parameters

public

then ( Closure $callback ) : $this

Register a callback to be called after the operation.

Parameters

public

thenWithOutput ( Closure $callback , $onlyIfOutputExists ) : $this

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

Parameters

  • $callback Closure
  • $onlyIfOutputExists bool
public

onSuccess ( Closure $callback ) : $this

Register a callback to be called if the operation succeeds.

Parameters

public

onSuccessWithOutput ( Closure $callback , $onlyIfOutputExists ) : $this

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

Parameters

  • $callback Closure
  • $onlyIfOutputExists bool
public

onFailure ( Closure $callback ) : $this

Register a callback to be called if the operation fails.

Parameters

public

onFailureWithOutput ( Closure $callback , $onlyIfOutputExists ) : $this

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

Parameters

  • $callback Closure
  • $onlyIfOutputExists bool
protected

withOutputCallback ( Closure $callback , $onlyIfOutputExists ) : Closure

Get a callback that provides output.

Parameters

  • $callback Closure
  • $onlyIfOutputExists bool
public

name ( $description ) : $this

Set the human-friendly description of the event.

Parameters

  • $description string
public

description ( $description ) : $this

Set the human-friendly description of the event.

Parameters

  • $description string
public

getSummaryForDisplay ( ) : string

Get the summary of the event for display.

public

nextRunDate ( $currentTime , $nth , $allowCurrentDate ) : Carbon

Determine the next due date for an event.

Parameters

public

getExpression ( ) : string

Get the Cron expression for the event.

public

preventOverlapsUsing ( EventMutex $mutex ) : $this

Set the event mutex implementation to be used.

Parameters

protected

removeMutex ( ) : void

Delete the mutex for the event.