当前位置: 首页>>代码示例>>PHP>>正文


PHP Manager::__construct方法代码示例

本文整理汇总了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();
 }
开发者ID:salmander,项目名称:ci-on-wings,代码行数:33,代码来源:Capsule.php

示例2: __construct

 public function __construct($config = [])
 {
     parent::__construct();
     foreach ($config as $name => $value) {
         $this->{$name} = $value;
     }
     $this->init();
 }
开发者ID:bixuehujin,项目名称:blink-laravel-database,代码行数:8,代码来源:Manager.php

示例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();
 }
开发者ID:arcostasi,项目名称:slimantic-skeleton,代码行数:14,代码来源:EloquentProvider.php

示例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();
 }
开发者ID:im286er,项目名称:LuckyPHP,代码行数:10,代码来源:Database.php

示例5: __construct

 /**
  *
  * @param string $connection
  * @param string $table
  */
 public function __construct($connection, $table)
 {
     parent::__construct();
 }
开发者ID:laralabs,项目名称:connection-loader,代码行数:9,代码来源:ConnectionLoader.php

示例6: __construct

 public function __construct($container)
 {
     parent::__construct($container);
     $this->bootEloquent();
 }
开发者ID:jjiko,项目名称:blog,代码行数:5,代码来源:Manager.php


注:本文中的Illuminate\Database\Capsule\Manager::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。