CallbackEvent (Console\Scheduling)

CallbackEvent

class CallbackEvent extends Event (View source)

Traits

Macroable
ManagesFrequencies

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
string $output The location that output should be sent to. from Event
bool $shouldAppendOutput Indicates whether output should be appended. from Event
string $description The human readable description of the event. from Event
Mutex $mutex The mutex implementation. from Event

Methods

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

Register a custom macro.

from Macroable
static bool hasMacro(string $name)

Checks if macro is registered.

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

Dynamically handle calls to the class.

from Macroable
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

from Macroable
$this cron(string $expression)

The Cron expression representing the event's frequency.

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

Schedule the event to run between start and end time.

from ManagesFrequencies
$this unlessBetween(string $startTime, string $endTime)

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

from ManagesFrequencies
$this hourly()

Schedule the event to run hourly.

from ManagesFrequencies
$this hourlyAt(int $offset)

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

from ManagesFrequencies
$this daily()

Schedule the event to run daily.

from ManagesFrequencies
$this at(string $time)

Schedule the command at a given time.

from ManagesFrequencies
$this dailyAt(string $time)

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

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

Schedule the event to run twice daily.

from ManagesFrequencies
$this weekdays()

Schedule the event to run only on weekdays.

from ManagesFrequencies
$this weekends()

Schedule the event to run only on weekends.

from ManagesFrequencies
$this mondays()

Schedule the event to run only on Mondays.

from ManagesFrequencies
$this tuesdays()

Schedule the event to run only on Tuesdays.

from ManagesFrequencies
$this wednesdays()

Schedule the event to run only on Wednesdays.

from ManagesFrequencies
$this thursdays()

Schedule the event to run only on Thursdays.

from ManagesFrequencies
$this fridays()

Schedule the event to run only on Fridays.

from ManagesFrequencies
$this saturdays()

Schedule the event to run only on Saturdays.

from ManagesFrequencies
$this sundays()

Schedule the event to run only on Sundays.

from ManagesFrequencies
$this weekly()

Schedule the event to run weekly.

from ManagesFrequencies
$this weeklyOn(int $day, string $time = '0:0')

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

from ManagesFrequencies
$this monthly()

Schedule the event to run monthly.

from ManagesFrequencies
$this monthlyOn(int $day = 1, string $time = '0:0')

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

from ManagesFrequencies
$this quarterly()

Schedule the event to run quarterly.

from ManagesFrequencies
$this yearly()

Schedule the event to run yearly.

from ManagesFrequencies
$this everyMinute()

Schedule the event to run every minute.

from ManagesFrequencies
$this everyFiveMinutes()

Schedule the event to run every five minutes.

from ManagesFrequencies
$this everyTenMinutes()

Schedule the event to run every ten minutes.

from ManagesFrequencies
$this everyThirtyMinutes()

Schedule the event to run every thirty minutes.

from ManagesFrequencies
$this days(array|mixed $days)

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

from ManagesFrequencies
$this timezone(DateTimeZone|string $timezone)

Set the timezone the date should be evaluated on.

from ManagesFrequencies
void __construct(Mutex $mutex, string $callback, array $parameters = array())

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

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, 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

Details

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

Register a custom macro.

Parameters

string $name
callable $macro

Return Value

void

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

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

Schedule the event to run hourly.

Return Value

$this

$this hourlyAt(int $offset)

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

Parameters

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

$this monthly()

Schedule the event to run monthly.

Return Value

$this

$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

$this quarterly()

Schedule the event to run quarterly.

Return Value

$this

$this yearly()

Schedule the event to run yearly.

Return Value

$this

$this everyMinute()

Schedule the event to run every minute.

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

Schedule the event to run every thirty minutes.

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

void __construct(Mutex $mutex, string $callback, array $parameters = array())

Create a new event instance.

Parameters

Mutex $mutex
string $callback
array $parameters

Return Value

void

Exceptions

InvalidArgumentException

string getDefaultOutput()

Get the default output depending on the OS.

Return Value

string

void run(Container $container)

Run the given event.

Parameters

Container $container

Return Value

void

Exceptions

Exception

string mutexName()

Get the mutex name for the scheduled command.

Return Value

string

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

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

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

Parameters

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

State that the command should run in background.

Return Value

$this

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

Do not allow the event to overlap each other.

Return Value

$this

Exceptions

LogicException

$this when(Closure $callback)

Register a callback to further filter the schedule.

Parameters

Closure $callback

Return Value

$this

$this skip(Closure $callback)

Register a callback to further filter the schedule.

Parameters

Closure $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 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(DateTime|string $currentTime = 'now', int $nth, bool $allowCurrentDate = false)

Determine the next due date for an event.

Parameters

DateTime|string $currentTime
int $nth
bool $allowCurrentDate

Return Value

Carbon

string getExpression()

Get the Cron expression for the event.

Return Value

string

$this preventOverlapsUsing(Mutex $mutex)

Set the mutex implementation to be used.

Parameters

Mutex $mutex

Return Value

$this

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Console/Scheduling/CallbackEvent.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部