abstract class MultipleInstanceManager (View source)

Properties

protected Application $app

The application instance.

protected Repository $config

The configuration repository instance.

protected array $instances

The array of resolved instances.

protected array $customCreators

The registered custom instance creators.

protected string $driverKey

The key name of the "driver" equivalent configuration option.

Methods

void
__construct(Application $app)

Create a new manager instance.

string
getDefaultInstance()

Get the default instance name.

void
setDefaultInstance(string $name)

Set the default instance name.

array
getInstanceConfig(string $name)

Get the instance specific configuration.

mixed
instance(string|null $name = null)

Get an instance by name.

mixed
get(string $name)

Attempt to get an instance from the local cache.

mixed
resolve(string $name)

Resolve the given instance.

mixed
callCustomCreator(array $config)

Call a custom instance creator.

$this
forgetInstance(array|string|null $name = null)

Unset the given instances.

void
purge(string|null $name = null)

Disconnect the given instance and remove from local cache.

$this
extend(string $name, Closure $callback)

Register a custom instance creator Closure.

$this
setApplication(Application $app)

Set the application instance used by the manager.

mixed
__call(string $method, array $parameters)

Dynamically call the default instance.

Details

void __construct(Application $app)

Create a new manager instance.

Parameters

Application $app

Return Value

void

abstract string getDefaultInstance()

Get the default instance name.

Return Value

string

abstract void setDefaultInstance(string $name)

Set the default instance name.

Parameters

string $name

Return Value

void

abstract array getInstanceConfig(string $name)

Get the instance specific configuration.

Parameters

string $name

Return Value

array

mixed instance(string|null $name = null)

Get an instance by name.

Parameters

string|null $name

Return Value

mixed

protected mixed get(string $name)

Attempt to get an instance from the local cache.

Parameters

string $name

Return Value

mixed

protected mixed resolve(string $name)

Resolve the given instance.

Parameters

string $name

Return Value

mixed

Exceptions

InvalidArgumentException
RuntimeException

protected mixed callCustomCreator(array $config)

Call a custom instance creator.

Parameters

array $config

Return Value

mixed

$this forgetInstance(array|string|null $name = null)

Unset the given instances.

Parameters

array|string|null $name

Return Value

$this

void purge(string|null $name = null)

Disconnect the given instance and remove from local cache.

Parameters

string|null $name

Return Value

void

$this extend(string $name, Closure $callback)

Register a custom instance creator Closure.

Parameters

string $name
Closure $callback

Return Value

$this

$this setApplication(Application $app)

Set the application instance used by the manager.

Parameters

Application $app

Return Value

$this

mixed __call(string $method, array $parameters)

Dynamically call the default instance.

Parameters

string $method
array $parameters

Return Value

mixed

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.