class Event (View source)

Properties

string $command The command string.
string $expression The cron expression representing the event's frequency.
DateTimeZone|string $timezone The timezone the date should be evaluated on.
string $user The user the command should run as.
array $environments The list of environments the command should run under.
bool $evenInMaintenanceMode Indicates if the command should run in maintenance mode.
bool $withoutOverlapping Indicates if the command should not overlap itself.
string $output The location that output should be sent to.
string $description The human readable description of the event.

Methods

void
__construct( string $command)

Create a new event instance.

void
run( Container $container)

Run the given event.

string
buildCommand()

Build the command string.

bool
isDue( Application $app)

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

bool
filtersPass( Application $app)

Determine if the filters pass for the event.

bool
runsInEnvironment( string $environment)

Determine if the event runs in the given environment.

bool
runsInMaintenanceMode()

Determine if the event runs in maintenance mode.

$this
cron( string $expression)

The Cron expression representing the event's frequency.

$this
hourly()

Schedule the event to run hourly.

$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
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
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
user( string $user)

Set which user the command should run as.

$this
environments( array|mixed $environments)

Limit the environments the command should run in.

$this
evenInMaintenanceMode()

State that the command should run even in maintenance mode.

$this
withoutOverlapping()

Do not allow the event to overlap each other.

$this
when( Closure $callback)

Register a callback to further filter the schedule.

$this
skip( Closure $callback)

Register a callback to further filter the schedule.

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

Send the output of the command to a given location.

$this
appendOutputTo( string $location)

Append the output of the command to a given location.

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

E-mail the results of the scheduled operation.

$this
emailWrittenOutputTo( array|mixed $addresses)

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

$this
pingBefore( string $url)

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

$this
before( Closure $callback)

Register a callback to be called before the operation.

$this
thenPing( string $url)

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

$this
after( Closure $callback)

Register a callback to be called after the operation.

$this
then( Closure $callback)

Register a callback to be called after the operation.

$this
name( string $description)

Set the human-friendly description of the event.

$this
description( string $description)

Set the human-friendly description of the event.

string
getSummaryForDisplay()

Get the summary of the event for display.

string
getExpression()

Get the Cron expression for the event.

Details

at line line 121
void __construct( string $command)

Create a new event instance.

Parameters

string $command

Return Value

void

at line line 143
void run( Container $container)

Run the given event.

Parameters

Container $container

Return Value

void

at line line 196
string buildCommand()

Build the command string.

Return Value

string

at line line 231
bool isDue( Application $app)

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

Parameters

Application $app

Return Value

bool

at line line 263
bool filtersPass( Application $app)

Determine if the filters pass for the event.

Parameters

Application $app

Return Value

bool

at line line 286
bool runsInEnvironment( string $environment)

Determine if the event runs in the given environment.

Parameters

string $environment

Return Value

bool

at line line 296
bool runsInMaintenanceMode()

Determine if the event runs in maintenance mode.

Return Value

bool

at line line 307
$this cron( string $expression)

The Cron expression representing the event's frequency.

Parameters

string $expression

Return Value

$this

at line line 319
$this hourly()

Schedule the event to run hourly.

Return Value

$this

at line line 329
$this daily()

Schedule the event to run daily.

Return Value

$this

at line line 340
$this at( string $time)

Schedule the command at a given time.

Parameters

string $time

Return Value

$this

at line line 351
$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

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

Schedule the event to run twice daily.

Parameters

int $first
int $second

Return Value

$this

at line line 379
$this weekdays()

Schedule the event to run only on weekdays.

Return Value

$this

at line line 389
$this mondays()

Schedule the event to run only on Mondays.

Return Value

$this

at line line 399
$this tuesdays()

Schedule the event to run only on Tuesdays.

Return Value

$this

at line line 409
$this wednesdays()

Schedule the event to run only on Wednesdays.

Return Value

$this

at line line 419
$this thursdays()

Schedule the event to run only on Thursdays.

Return Value

$this

at line line 429
$this fridays()

Schedule the event to run only on Fridays.

Return Value

$this

at line line 439
$this saturdays()

Schedule the event to run only on Saturdays.

Return Value

$this

at line line 449
$this sundays()

Schedule the event to run only on Sundays.

Return Value

$this

at line line 459
$this weekly()

Schedule the event to run weekly.

Return Value

$this

at line line 471
$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

at line line 483
$this monthly()

Schedule the event to run monthly.

Return Value

$this

at line line 495
$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

at line line 507
$this quarterly()

Schedule the event to run quarterly.

Return Value

$this

at line line 517
$this yearly()

Schedule the event to run yearly.

Return Value

$this

at line line 527
$this everyMinute()

Schedule the event to run every minute.

Return Value

$this

at line line 537
$this everyFiveMinutes()

Schedule the event to run every five minutes.

Return Value

$this

at line line 547
$this everyTenMinutes()

Schedule the event to run every ten minutes.

Return Value

$this

at line line 557
$this everyThirtyMinutes()

Schedule the event to run every thirty minutes.

Return Value

$this

at line line 568
$this days( array|mixed $days)

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

Parameters

array|mixed $days

Return Value

$this

at line line 581
$this timezone( DateTimeZone|string $timezone)

Set the timezone the date should be evaluated on.

Parameters

DateTimeZone|string $timezone

Return Value

$this

at line line 594
$this user( string $user)

Set which user the command should run as.

Parameters

string $user

Return Value

$this

at line line 607
$this environments( array|mixed $environments)

Limit the environments the command should run in.

Parameters

array|mixed $environments

Return Value

$this

at line line 619
$this evenInMaintenanceMode()

State that the command should run even in maintenance mode.

Return Value

$this

at line line 631
$this withoutOverlapping()

Do not allow the event to overlap each other.

Return Value

$this

at line line 646
$this when( Closure $callback)

Register a callback to further filter the schedule.

Parameters

Closure $callback

Return Value

$this

at line line 659
$this skip( Closure $callback)

Register a callback to further filter the schedule.

Parameters

Closure $callback

Return Value

$this

at line line 673
$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

at line line 688
$this appendOutputTo( string $location)

Append the output of the command to a given location.

Parameters

string $location

Return Value

$this

at line line 702
$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

at line line 723
$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

at line line 773
$this pingBefore( string $url)

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

Parameters

string $url

Return Value

$this

at line line 786
$this before( Closure $callback)

Register a callback to be called before the operation.

Parameters

Closure $callback

Return Value

$this

at line line 799
$this thenPing( string $url)

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

Parameters

string $url

Return Value

$this

at line line 812
$this after( Closure $callback)

Register a callback to be called after the operation.

Parameters

Closure $callback

Return Value

$this

at line line 823
$this then( Closure $callback)

Register a callback to be called after the operation.

Parameters

Closure $callback

Return Value

$this

at line line 836
$this name( string $description)

Set the human-friendly description of the event.

Parameters

string $description

Return Value

$this

at line line 847
$this description( string $description)

Set the human-friendly description of the event.

Parameters

string $description

Return Value

$this

at line line 875
string getSummaryForDisplay()

Get the summary of the event for display.

Return Value

string

at line line 889
string getExpression()

Get the Cron expression for the event.

Return Value

string