class Illuminate / Bus / Dispatcher
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Dispatcher

Implements

Properties

protected

$container Container

The container implementation.

Default: null
protected

$pipeline Pipeline

The pipeline instance for the bus.

Default: null
protected

$pipes array

The pipes to send commands through before dispatching.

Default: []
protected

$handlers array

The command to handler mapping for non-self-handling events.

Default: []
protected

$queueResolver Closure |null

The queue resolver callback.

Default: null

Methods

public

__construct ( Container $container , Closure $queueResolver ) : void

Create a new command dispatcher instance.

Parameters

public

dispatch ( $command ) : mixed

Dispatch a command to its appropriate handler.

Parameters

  • $command mixed
public

dispatchSync ( $command , $handler ) : mixed

Dispatch a command to its appropriate handler in the current process.

Parameters

  • $command mixed
  • $handler mixed
public

dispatchNow ( $command , $handler ) : mixed

Dispatch a command to its appropriate handler in the current process without using the synchronous queue.

Parameters

  • $command mixed
  • $handler mixed
public

findBatch ( string $batchId ) : Batch |null

Attempt to find the batch with the given ID.

Parameters

  • $batchId string
public

batch ( $jobs ) : PendingBatch

Create a new batch of queueable jobs.

Parameters

  • $jobs Illuminate\...\Collection|array|mixed
public

chain ( $jobs ) : PendingChain

Create a new chain of queueable jobs.

Parameters

  • $jobs Illuminate\...\Collection|array
public

hasCommandHandler ( $command ) : bool

Determine if the given command has a handler.

Parameters

  • $command mixed
public

getCommandHandler ( $command ) : bool|mixed

Retrieve the handler for a command.

Parameters

  • $command mixed
protected

commandShouldBeQueued ( $command ) : bool

Determine if the given command should be queued.

Parameters

  • $command mixed
public

dispatchToQueue ( $command ) : mixed

Dispatch a command to its appropriate handler behind a queue.

Parameters

  • $command mixed
protected

pushCommandToQueue ( $queue , $command ) : mixed

Push the command onto the given queue instance.

Parameters

public

dispatchAfterResponse ( $command , $handler ) : void

Dispatch a command to its appropriate handler after the current process.

Parameters

  • $command mixed
  • $handler mixed
public

pipeThrough ( array $pipes ) : $this

Set the pipes through which commands should be piped before dispatching.

Parameters

  • $pipes array
public

map ( array $map ) : $this

Map a command to a handler.

Parameters

  • $map array