LaravelDatabase

Summary

No protected properties found
N/A
No private methods found
No private properties found
N/A
File
database.php
Package
Default
Class hierarchy
LaravelDatabase

Tags

None found

Properties

$connections

$connections : array

The established database connections.

Type

array

Tags

None found

$registrar

$registrar : array

The third-party driver registrar.

Type

array

Tags

None found

Methods

connection()

connection(string  $connection = null) : \Laravel\Database\Connection

Get a database connection.

If no database name is specified, the default connection will be returned.

// Get the default database connection for the application $connection = DB::connection();

// Get a specific connection by passing the connection name
$connection = DB::connection('mysql');

Parameters

string $connection

Returns

LaravelDatabaseConnection

static

Tags

None found

table()

table(string  $table, string  $connection = null) : \Laravel\Database\Query

Begin a fluent query against a table.

Parameters

string $table
string $connection

Returns

LaravelDatabaseQuery

static

Tags

None found

raw()

raw(string  $value) : \Laravel\Database\Expression

Create a new database expression instance.

Database expressions are used to inject raw SQL into a fluent query.

Parameters

string $value

Returns

LaravelDatabaseExpression

static

Tags

None found

escape()

escape(string  $value) : string

Escape a string for usage in a query.

This uses the correct quoting mechanism for the default database connection.

Parameters

string $value

Returns

string

static

Tags

None found

profile()

profile() : array

Get the profiling data for all queries.

Returns

array

static

Tags

None found

last_query()

last_query() : string

Get the last query that was executed.

Returns false if no queries have been executed yet.

Returns

string

static

Tags

None found

extend()

extend(string  $name, \Closure  $connector, \Closure  $query = null, \Closure  $schema = null) : void

Register a database connector and grammars.

Parameters

string $name
Closure $connector
Closure $query
Closure $schema

static

Tags

None found

__callStatic()

__callStatic(  $method,   $parameters) 

Magic Method for calling methods on the default database connection.

// Get the driver name for the default database connection $driver = DB::driver();

// Execute a fluent query on the default database connection
$users = DB::table('users')->get();

Parameters

$method
$parameters

static

Tags

None found

connect()

connect(array  $config) : \Laravel\PDO

Get a PDO database connection for a given database configuration.

Parameters

array $config

Returns

LaravelPDO

static

Tags

None found

connector()

connector(string  $driver) : \Laravel\Database\Connectors\Connector

Create a new database connector instance.

Parameters

string $driver

Returns

LaravelDatabaseConnectorsConnector

static

Tags

None found