Manager
class Manager
Standalone database manager for non-production use outside full application bootstrap.
Uses SimpleConnectionResolver to retain non-pooled connections, including in-memory SQLite databases, without requiring full application bootstrap.
For production Swoole applications with connection pooling, use the full Hypervel application with ConnectionResolver instead.
Traits
Properties
| static protected object|null | $instance | The current globally used instance. |
from CapsuleManagerTrait |
| protected Container | $container | The container instance. |
from CapsuleManagerTrait |
| protected DatabaseManager | $manager | The database manager instance. |
Methods
Setup the default database configuration options.
Build the database manager instance.
Get a connection instance from the global manager.
Get a registered connection instance.
Register a connection with the manager.
Bootstrap Eloquent so it is ready for usage.
Get the database manager instance.
Get the current event dispatcher instance.
Set the event dispatcher instance to be used by connections.
Dynamically pass methods to the default connection.
Details
in
CapsuleManagerTrait at line 25
protected void
setupContainer(Container $container)
Setup the IoC container instance.
in
CapsuleManagerTrait at line 40
void
setAsGlobal()
Make this capsule instance available globally.
Boot or tests only. Swaps the global Capsule instance used by static calls; request-time use races across coroutines.
in
CapsuleManagerTrait at line 48
Container
getContainer()
Get the IoC container instance.
in
CapsuleManagerTrait at line 59
void
setContainer(Container $container)
Set the IoC container instance.
Boot or tests only. Swaps the Capsule container used by this standalone manager; request-time use races across coroutines.
in
CapsuleManagerTrait at line 67
static void
flushState()
Flush all static state.
at line 45
__construct(Container|null $container = null)
Create a new database capsule manager.
at line 60
protected void
setupDefaultConfiguration()
Setup the default database configuration options.
at line 70
protected void
setupManager()
Build the database manager instance.
at line 88
static ConnectionInterface
connection(string|null $connection = null)
Get a connection instance from the global manager.
at line 96
static Builder
table(Closure|Builder|Builder|Relation|Expression|UnitEnum|string $table, string|null $as = null, string|null $connection = null)
Get a fluent query builder instance.
at line 104
static Builder
schema(string|null $connection = null)
Get a schema builder instance.
at line 112
ConnectionInterface
getConnection(string|null $name = null)
Get a registered connection instance.
at line 120
void
addConnection(array $config, string $name = 'default')
Register a connection with the manager.
at line 133
void
bootEloquent()
Bootstrap Eloquent so it is ready for usage.
at line 151
DatabaseManager
getDatabaseManager()
Get the database manager instance.
at line 159
Dispatcher|null
getEventDispatcher()
Get the current event dispatcher instance.
at line 171
void
setEventDispatcher(Dispatcher $dispatcher)
Set the event dispatcher instance to be used by connections.
at line 179
static mixed
__callStatic(string $method, array $parameters)
Dynamically pass methods to the default connection.