Database Class
Aurora\Database Namespace
Properties
default
Default connection name
protected $default: string
connections
Connections array
protected $connections = []: array
Constructor
__construct
Constructor
Parameters
string
$default
— Default connection name
Signature
public function __construct(string $default)
Methods
__construct
Constructor
Parameters
-
string
$default
— Default connection name
Signature
public function __construct(string $default)
connect
Add a new connection
Parameters
-
string
$name
— Connection name -
array
$options
— Connection options
Return Value
$this
Signature
public function connect(string $name, array $options)
connection
Get a connection
Parameters
-
string
$name
— Connection name -
Closure
$callback
— Callback to execute
Return Value
mixed
Signature
public function connection(string $name, Closure $callback)
query
Execute a query
Parameters
-
string
$query
— Query string -
array
$parameters
— Array of parameters -
Closure
$callback
— Optional callback
Return Value
mixed
Signature
public function query(string $query, array $parameters = [], Closure $callback)
transaction
Execute a transaction
Parameters
-
Closure
$callback
— Transaction callback
Return Value
bool
Signature
public function transaction(Closure $callback)
lastInsertId
Get the last inserted ID
Return Value
int
Signature
public function lastInsertId(): int