當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。