class Schedule mixin PendingEventAttributes

Traits

Constants

SUNDAY

MONDAY

TUESDAY

WEDNESDAY

THURSDAY

FRIDAY

SATURDAY

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected array $events

All of the events on the schedule.

protected EventMutex $eventMutex

The event mutex implementation.

protected SchedulingMutex $schedulingMutex

The scheduling mutex implementation.

protected Dispatcher|null $dispatcher

The job dispatcher implementation.

protected array<string, bool> $mutexCache

The cache of mutex results.

protected string|null $mutexCacheMinute

The minute currently represented by the in-memory mutex cache.

protected PendingEventAttributes|null $attributes

The attributes to pass to the event.

protected PendingEventAttributes> $groupStack

The schedule group attributes stack.

static bool $pausable

Indicates if the scheduler can be paused.

static bool $interruptible

Indicates if the scheduler can be interrupted.

Methods

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

Register a custom macro.

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

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

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

Dynamically handle calls to the class.

__call(string $method, array $parameters)

Dynamically handle calls into the schedule instance.

__construct(DateTimeZone|string|null $timezone = null)

Create a new schedule instance.

call(callable|string|array $callback, array $parameters = [])

Add a new callback event to the schedule.

command(Command|string $command, array $parameters = [])

Add a new Artisan command event to the schedule.

job(object|string $job, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Add a new job callback event to the schedule.

void
dispatchToQueue(object $job, string|null $queue, string|null $connection)

Dispatch the given job to the queue.

void
dispatchUniqueJobToQueue(object $job, string|null $queue, string|null $connection)

Dispatch the given unique job to the queue.

void
dispatchNow(object $job)

Dispatch the given job right now.

exec(string $command, array $parameters = [], bool $isSystem = true)

Add a new command event to the schedule.

void
group(Closure $events)

Create new schedule group.

void
mergePendingAttributes(Event $event)

Merge the current group attributes with the given event.

string
compileParameters(array $parameters)

Compile parameters for a command.

string
compileArrayInput(int|string $key, array $value)

Compile array input for a command.

bool
serverShouldRun(Event $event, DateTimeInterface $time)

Determine if the server is allowed to run this event.

dueEvents(Application $app)

Get all of the events on the schedule that are due.

dueEventsAt(Application $app, DateTimeInterface $time)

Get all of the events on the schedule that are due at the given time.

array
events()

Get all of the events on the schedule.

array
eventsForEnvironments(array $environments)

Get all of the events on the schedule which run on any of the provided environments.

useCache(UnitEnum|string|null $store)

Specify the cache store that should be used to store mutexes.

static void
withoutInterruptionPolling()

Disable pause and interrupt polling for the scheduler.

getDispatcher()

Get the job dispatcher, if available.

static void
flushState()

Flush all static state.

Details

in Macroable at line 28
static void macro(string $name, callable|object $macro)

Register a custom macro.

Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 78
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 514
__call(string $method, array $parameters)

Dynamically handle calls into the schedule instance.

Parameters

string $method
array $parameters

at line 118
__construct(DateTimeZone|string|null $timezone = null)

Create a new schedule instance.

Parameters

DateTimeZone|string|null $timezone

the timezone the date should be evaluated on

Exceptions

RuntimeException

at line 141
CallbackEvent call(callable|string|array $callback, array $parameters = [])

Add a new callback event to the schedule.

Parameters

callable|string|array $callback
array $parameters

Return Value

CallbackEvent

at line 158
Event command(Command|string $command, array $parameters = [])

Add a new Artisan command event to the schedule.

Parameters

Command|string $command
array $parameters

Return Value

Event

at line 180
CallbackEvent job(object|string $job, UnitEnum|string|null $queue = null, UnitEnum|string|null $connection = null)

Add a new job callback event to the schedule.

Parameters

object|string $job
UnitEnum|string|null $queue
UnitEnum|string|null $connection

Return Value

CallbackEvent

at line 223
protected void dispatchToQueue(object $job, string|null $queue, string|null $connection)

Dispatch the given job to the queue.

Parameters

object $job
string|null $queue
string|null $connection

Return Value

void

Exceptions

RuntimeException

at line 258
protected void dispatchUniqueJobToQueue(object $job, string|null $queue, string|null $connection)

Dispatch the given unique job to the queue.

Parameters

object $job
string|null $queue
string|null $connection

Return Value

void

Exceptions

RuntimeException

at line 288
protected void dispatchNow(object $job)

Dispatch the given job right now.

Parameters

object $job

Return Value

void

at line 296
Event exec(string $command, array $parameters = [], bool $isSystem = true)

Add a new command event to the schedule.

Parameters

string $command
array $parameters
bool $isSystem

Return Value

Event

at line 314
void group(Closure $events)

Create new schedule group.

Parameters

Closure $events

Return Value

void

Exceptions

RuntimeException

at line 331
protected void mergePendingAttributes(Event $event)

Merge the current group attributes with the given event.

Parameters

Event $event

Return Value

void

at line 349
protected string compileParameters(array $parameters)

Compile parameters for a command.

Parameters

array $parameters

Return Value

string

at line 367
string compileArrayInput(int|string $key, array $value)

Compile array input for a command.

Parameters

int|string $key
array $value

Return Value

string

at line 389
bool serverShouldRun(Event $event, DateTimeInterface $time)

Determine if the server is allowed to run this event.

Parameters

Event $event
DateTimeInterface $time

Return Value

bool

at line 404
Collection dueEvents(Application $app)

Get all of the events on the schedule that are due.

Parameters

Application $app

Return Value

Collection

at line 412
Collection dueEventsAt(Application $app, DateTimeInterface $time)

Get all of the events on the schedule that are due at the given time.

Parameters

Application $app
DateTimeInterface $time

Return Value

Collection

at line 423
array events()

Get all of the events on the schedule.

Return Value

array Event[]

at line 434
array eventsForEnvironments(array $environments)

Get all of the events on the schedule which run on any of the provided environments.

Parameters

array $environments

Return Value

array

at line 448
Schedule useCache(UnitEnum|string|null $store)

Specify the cache store that should be used to store mutexes.

Boot-only. Mutates the shared mutex instances used by this worker's schedule; per-request use races across coroutines.

Parameters

UnitEnum|string|null $store

Return Value

Schedule

at line 473
static void withoutInterruptionPolling()

Disable pause and interrupt polling for the scheduler.

Boot-only. Mutates process-global scheduler flags; runtime use changes pause and interrupt behavior for every concurrent scheduler run.

Return Value

void

at line 484
protected Dispatcher getDispatcher()

Get the job dispatcher, if available.

Return Value

Dispatcher

Exceptions

RuntimeException

at line 504
static void flushState()

Flush all static state.

Return Value

void