CallbackEvent
class CallbackEvent extends Event (View source)
Properties
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 |
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 |
protected 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 |
protected string | $callback | The callback to call. | |
protected array | $parameters | The parameters to pass to the method. |
Methods
void | __construct(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. | |
void | runCommandInForeground(Container $container) Run the command in the foreground. | from Event |
void | runCommandInBackground() 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 |
string | mutexPath() Get the mutex path for the scheduled command. | |
bool | isDue(Application $app) Determine if the given event should run based on the Cron expression. | from Event |
bool | expressionPasses() Determine if the Cron expression passes. | from Event |
bool | filtersPass(Application $app) Determine if the filters pass for the event. | from Event |
bool | runsInEnvironment(string $environment) Determine if the event runs in the given environment. | from Event |
bool | runsInMaintenanceMode() Determine if the event runs in maintenance mode. | from Event |
$this | cron(string $expression) The Cron expression representing the event's frequency. | from Event |
$this | hourly() Schedule the event to run hourly. | from Event |
$this | daily() Schedule the event to run daily. | from Event |
$this | at(string $time) Schedule the command at a given time. | from Event |
$this | dailyAt(string $time) Schedule the event to run daily at a given time (10:00, 19:30, etc). | from Event |
$this | twiceDaily(int $first = 1, int $second = 13) Schedule the event to run twice daily. | from Event |
$this | weekdays() Schedule the event to run only on weekdays. | from Event |
$this | mondays() Schedule the event to run only on Mondays. | from Event |
$this | tuesdays() Schedule the event to run only on Tuesdays. | from Event |
$this | wednesdays() Schedule the event to run only on Wednesdays. | from Event |
$this | thursdays() Schedule the event to run only on Thursdays. | from Event |
$this | fridays() Schedule the event to run only on Fridays. | from Event |
$this | saturdays() Schedule the event to run only on Saturdays. | from Event |
$this | sundays() Schedule the event to run only on Sundays. | from Event |
$this | weekly() Schedule the event to run weekly. | from Event |
$this | weeklyOn(int $day, string $time = '0:0') Schedule the event to run weekly on a given day and time. | from Event |
$this | monthly() Schedule the event to run monthly. | from Event |
$this | monthlyOn(int $day = 1, string $time = '0:0') Schedule the event to run monthly on a given day and time. | from Event |
$this | quarterly() Schedule the event to run quarterly. | from Event |
$this | yearly() Schedule the event to run yearly. | from Event |
$this | everyMinute() Schedule the event to run every minute. | from Event |
$this | everyFiveMinutes() Schedule the event to run every five minutes. | from Event |
$this | everyTenMinutes() Schedule the event to run every ten minutes. | from Event |
$this | everyThirtyMinutes() Schedule the event to run every thirty minutes. | from Event |
$this | days(array|mixed $days) Set the days of the week the command should run on. | from Event |
$this | runInBackground() State that the command should run in background. | from Event |
$this | timezone(DateTimeZone|string $timezone) Set the timezone the date should be evaluated on. | 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() 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 | 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 | 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 | before(Closure $callback) Register a callback to be called before the operation. | from Event |
$this | thenPing(string $url) Register a callback to ping a given URL after the job runs. | 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 |
$this | spliceIntoPosition(int $position, string $value) Splice the given value into the given position of the expression. | from Event |
string | getSummaryForDisplay() Get the summary of the event for display. | |
string | getExpression() Get the Cron expression for the event. | from Event |
void | removeMutex() Remove the mutex file from disk. |
Details
void __construct(string $callback, array $parameters = [])
Create a new event instance.
protected string getDefaultOutput()
Get the default output depending on the OS.
void run(Container $container)
Run the given event.
protected void runCommandInForeground(Container $container)
Run the command in the foreground.
protected void runCommandInBackground()
Run the command in the background.
protected void callBeforeCallbacks(Container $container)
Call all of the "before" callbacks for the event.
protected void callAfterCallbacks(Container $container)
Call all of the "after" callbacks for the event.
string buildCommand()
Build the command string.
protected string mutexPath()
Get the mutex path for the scheduled command.
bool isDue(Application $app)
Determine if the given event should run based on the Cron expression.
protected bool expressionPasses()
Determine if the Cron expression passes.
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 runInBackground()
State that the command should run in background.
$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.
protected void emailOutput(Mailer $mailer, array $addresses, bool $onlyIfOutputExists = false)
E-mail the output of the event to the recipients.
protected string getEmailSubject()
Get the e-mail subject line for output results.
$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.
protected $this spliceIntoPosition(int $position, string $value)
Splice the given value into the given position of the expression.
string getSummaryForDisplay()
Get the summary of the event for display.
string getExpression()
Get the Cron expression for the event.
protected void removeMutex()
Remove the mutex file from disk.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.3/Illuminate/Console/Scheduling/CallbackEvent.html