Illuminate\Database\Connection::__construct PHP Method

__construct() public method

Create a new database connection instance.
public __construct ( PDO | Closure $pdo, string $database = '', string $tablePrefix = '', array $config = [] ) : void
$pdo PDO | Closure
$database string
$tablePrefix string
$config array
return void
    public function __construct($pdo, $database = '', $tablePrefix = '', array $config = [])
    {
        $this->pdo = $pdo;
        // First we will setup the default properties. We keep track of the DB
        // name we are connected to since it is needed when some reflective
        // type commands are run such as checking whether a table exists.
        $this->database = $database;
        $this->tablePrefix = $tablePrefix;
        $this->config = $config;
        // We need to initialize a query grammar and the query post processors
        // which are both very important parts of the database abstractions
        // so we initialize these to their default values while starting.
        $this->useDefaultQueryGrammar();
        $this->useDefaultPostProcessor();
    }

Usage Example

Exemplo n.º 1
0
 public function __construct(PDO $pdo, Grammar $grammar, Processor $processor, DoctrineDriver $doctrine = null)
 {
     parent::__construct($pdo);
     $this->queryGrammar = new GrammarWrapper($grammar);
     $this->postProcessor = $processor;
     $this->doctrine = $doctrine;
 }
All Usage Examples Of Illuminate\Database\Connection::__construct