ChannelManager
class ChannelManager extends Manager implements Dispatcher, Factory
Traits
Constants
| protected DEFAULT_CHANNEL_CONTEXT_KEY |
Context key for the per-request default channel override. |
| protected DEFAULT_LOCALE_CONTEXT_KEY |
Context key for the per-request default locale override. |
Properties
| protected Repository | $config | The configuration repository instance. |
from Manager |
| protected array | $customCreators | The registered custom driver creators. |
from Manager |
| protected array | $drivers | The array of created "drivers". |
from Manager |
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected string | $defaultChannel | The default channel used to deliver messages. |
|
| protected string|null | $locale | The locale used when sending notifications. |
Methods
Get the default channel driver name.
Create a new driver instance.
Dynamically handle calls to the class.
Mix another object into the class.
Dynamically handle calls to the class.
Resolve the default connection name for a given queueable instance.
Resolve the default queue name for a given queueable instance.
Send the given notification to the given notifiable entities.
Send the given notification immediately.
Get a channel instance.
Create an instance of the database driver.
Create an instance of the broadcast driver.
Create an instance of the mail driver.
Create an instance of the slack driver.
Get the default channel driver name.
Set the default channel driver name.
Set the locale of notifications.
Get the locale of notifications.
Flush all static state.
Details
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
at line 134
string
getDefaultDriver()
Get the default channel driver name.
in
Manager at line 53
mixed
driver(UnitEnum|string|null $driver = null)
Get a driver instance.
at line 118
protected mixed
createDriver(string $driver)
Create a new driver instance.
in
Manager at line 99
protected mixed
callCustomCreator(string $driver)
Call a custom driver creator.
in
Manager at line 112
Manager
extend(string $driver, Closure $callback)
Register a custom driver creator Closure.
Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.
in
Manager at line 129
array
getDrivers()
Get all of the created "drivers".
in
Manager at line 151
Manager
setContainer(Container $container)
Set the container instance used by the manager.
Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent driver resolution through this manager.
in
Manager at line 167
Manager
forgetDrivers()
Forget all of the resolved driver instances.
Boot or tests only. Clears the singleton's driver cache; concurrent coroutines may already hold references that next resolution will not share.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
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.
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.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
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.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
ResolvesQueueRoutes at line 15
string|null
resolveConnectionFromQueueRoute(object $queueable)
Resolve the default connection name for a given queueable instance.
in
ResolvesQueueRoutes at line 23
string|null
resolveQueueFromQueueRoute(object $queueable)
Resolve the default queue name for a given queueable instance.
in
ResolvesQueueRoutes at line 31
protected QueueRoutes
queueRoutes()
Get the queue routes manager instance.
at line 50
void
send(mixed $notifiables, mixed $notification)
Send the given notification to the given notifiable entities.
at line 63
void
sendNow(mixed $notifiables, mixed $notification, array|null $channels = null)
Send the given notification immediately.
at line 76
mixed
channel(UnitEnum|string|null $name = null)
Get a channel instance.
at line 84
protected DatabaseChannel
createDatabaseDriver()
Create an instance of the database driver.
at line 92
protected BroadcastChannel
createBroadcastDriver()
Create an instance of the broadcast driver.
at line 100
protected MailChannel
createMailDriver()
Create an instance of the mail driver.
at line 108
protected SlackNotificationRouterChannel
createSlackDriver()
Create an instance of the slack driver.
at line 142
string
deliversVia()
Get the default channel driver name.
at line 150
void
deliverVia(string $channel)
Set the default channel driver name.
at line 158
ChannelManager
locale(string $locale)
Set the locale of notifications.
at line 168
string|null
getLocale()
Get the locale of notifications.
at line 176
static void
flushState()
Flush all static state.