本文整理汇总了PHP中Illuminate\Database\Capsule\Manager::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::__construct方法的具体用法?PHP Manager::__construct怎么用?PHP Manager::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Capsule\Manager
的用法示例。
在下文中一共展示了Manager::__construct方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Dispatcher
function __construct()
{
parent::__construct();
// Get CI instance to obtain DB settings
$ci =& get_instance();
$this->addConnection(array('driver' => 'mysql', 'host' => $ci->db->hostname, 'database' => $ci->db->database, 'username' => $ci->db->username, 'password' => $ci->db->password, 'charset' => $ci->db->char_set, 'collation' => $ci->db->dbcollat, 'prefix' => $ci->db->dbprefix));
// Listen to Model related events (saving, saved, updating, updated, creating, created etc).
$this->setEventDispatcher(new Dispatcher(new Container()));
// For CI Profiler (debugging utility)
$events = new Dispatcher();
$events->listen('illuminate.query', function ($query, $bindings, $time, $name) {
// Format binding data for sql insertion
foreach ($bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
} else {
if (is_string($binding)) {
$bindings[$i] = "'{$binding}'";
}
}
}
// Insert bindings into query
$query = str_replace(array('%', '?'), array('%%', '%s'), $query);
$query = vsprintf($query, $bindings);
// Add it into CodeIgniter
$ci =& get_instance();
$ci->db->query_times[] = $time;
$ci->db->queries[] = $query;
});
$this->setEventDispatcher($events);
$this->setAsGlobal();
$this->bootEloquent();
}
示例2: __construct
public function __construct($config = [])
{
parent::__construct();
foreach ($config as $name => $value) {
$this->{$name} = $value;
}
$this->init();
}
示例3: __construct
/**
* Database manager constructor.
*
* @param array $settings
*/
public function __construct($settings = [])
{
parent::__construct();
$this->addConnection($settings);
// Make this Capsule instance available globally via static methods
$this->setAsGlobal();
// Setup the Eloquent ORM
$this->bootEloquent();
}
示例4: __construct
public function __construct()
{
parent::__construct();
$databaseType = Configure::get('database', 'type');
$database = Configure::get('database', $databaseType);
$database['driver'] = $databaseType;
$this->addConnection($database);
$this->setAsGlobal();
$this->bootEloquent();
}
示例5: __construct
/**
*
* @param string $connection
* @param string $table
*/
public function __construct($connection, $table)
{
parent::__construct();
}
示例6: __construct
public function __construct($container)
{
parent::__construct($container);
$this->bootEloquent();
}