class Database

Properties

static $orm

Methods

static Manager
orm()

Get the ORM instance.

static bool
hasConnection(string $name)

Determines if a connection is defined in the ORM.

static mixed
tenant()

Shortcut for tenant connection.

static bool
tableExists(string $table, string $connection = "tenant")

Determines if table exists

static mixed
transaction(closure $closure, string $connection = "tenant")

Starts and wraps the code inside a database transaction.

static mixed
__callStatic(string $name, array $arguments)

Allows you to call the ORM's static methods through the Database class

Details

at line 17
static Manager orm()

Get the ORM instance.

Return Value

Manager

at line 38
static bool hasConnection(string $name)

Determines if a connection is defined in the ORM.

Parameters

string $name

The connection name

Return Value

bool

True if connection is defined, False otherwise.

at line 53
static mixed tenant()

Shortcut for tenant connection.

Return Value

mixed

Database connection

at line 65
static bool tableExists(string $table, string $connection = "tenant")

Determines if table exists

Parameters

string $table

The table name

string $connection

The database connection to use

Return Value

bool

True if table exists, False otherwise.

at line 86
static mixed transaction(closure $closure, string $connection = "tenant")

Starts and wraps the code inside a database transaction.

NOTE: Requires a compatible storage engine. $closure must ever return true on success, otherwise result will always be false $closure will have the transaction stdClass as first argument

Parameters

closure $closure

The closure containing the code to wrap inside transacion

string $connection

The ORM database connection

Return Value

mixed

Examples

\App\System\Database::tansaction(function($transaction) {\
    ...\
});

at line 116
static mixed __callStatic(string $name, array $arguments)

Allows you to call the ORM's static methods through the Database class

Parameters

string $name

The method name

array $arguments

The method arguments

Return Value

mixed

Examples

\App\System\Database::table(...)->...;\
\App\System\Database::addConnection(array $config, string $connection_name);\
\App\System\Database::connection(...);
\App\System\Database::raw(...);