當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Manager::setEventDispatcher方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Capsule\Manager::setEventDispatcher方法的典型用法代碼示例。如果您正苦於以下問題:PHP Manager::setEventDispatcher方法的具體用法?PHP Manager::setEventDispatcher怎麽用?PHP Manager::setEventDispatcher使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Capsule\Manager的用法示例。


在下文中一共展示了Manager::setEventDispatcher方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 private function __construct()
 {
     $this->capsule = new Capsule();
     $this->capsule->addConnection(['driver' => 'mysql', 'host' => DB_HOST, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
     $this->capsule->setEventDispatcher(new Dispatcher(new Container()));
     $this->capsule->setAsGlobal();
 }
開發者ID:hieu-pv,項目名稱:NFWP,代碼行數:7,代碼來源:DBManager.php

示例2: bootstrap

 /**
  * {@inheritdoc}
  */
 public function bootstrap($app)
 {
     $this->capsule = new Manager();
     $this->capsule->addConnection(['driver' => $this->driver, 'host' => $this->host, 'database' => $this->database, 'username' => $this->username, 'password' => $this->password, 'charset' => $this->charset, 'collation' => $this->collation, 'prefix' => $this->prefix]);
     $this->capsule->setEventDispatcher(new Dispatcher(new Container()));
     $this->capsule->setAsGlobal();
     $this->capsule->bootEloquent();
     $app->set('db', $this->capsule);
 }
開發者ID:lordthorzonus,項目名稱:yii2-eloquent,代碼行數:12,代碼來源:Yii2Eloquent.php

示例3: __construct

 public function __construct()
 {
     $capsule = new Capsule();
     $capsule->addConnection(["driver" => "mysql", "host" => "localhost", "database" => "development", "username" => "developer", "password" => "developer", "charset" => "utf8", "collation" => "utf8_general_ci", "prefix" => ""]);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->bootEloquent();
 }
開發者ID:raynaldmo,項目名稱:php-education,代碼行數:7,代碼來源:user.php

示例4: __construct

 public function __construct()
 {
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'designpatternscourse', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '']);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->bootEloquent();
 }
開發者ID:matteo-hertel,項目名稱:archive,代碼行數:7,代碼來源:posts.php

示例5: register

 public function register(Application $app)
 {
     $app['db'] = $app->share(function () use($app) {
         $capsule = new Capsule();
         if (!isset($app['i_db.config'])) {
             throw new \InvalidArgumentException('i_db.config is required.');
         }
         $db['config'] = $app['i_db.config'];
         if (!is_array($db)) {
             throw new \InvalidArgumentException('$app[\'i_db.config\'] must is array;');
         }
         $capsule->addConnection($db['config']);
         $db['i_db.event_dispatcher'] = isset($app['i_db.event_dispatcher']) ? $app['i_db.event_dispatcher'] : true;
         $db['i_db.global'] = isset($app['i_db.global']) ? $app['i_db.global'] : true;
         $db['i_db.boot_eloquent'] = isset($app['i_db.boot_eloquent']) ? $app['i_db.boot_eloquent'] : true;
         if ($db['i_db.event_dispatcher']) {
             $capsule->setEventDispatcher(new Dispatcher(new Container()));
         }
         if ($db['i_db.global']) {
             $capsule->setAsGlobal();
         }
         if ($db['i_db.event_dispatcher'] or $db['i_db.boot_eloquent']) {
             $capsule->bootEloquent();
         }
         return $capsule;
     });
 }
開發者ID:CakePHPBrasil,項目名稱:cakephpbrasil.com.br,代碼行數:27,代碼來源:ServiceProvider.php

示例6: register

 /**
  * Register the service provider.
  */
 public function register()
 {
     $manager = new Manager();
     $manager->addConnection($this->app->config->get('database')['default']);
     $manager->setEventDispatcher(new Dispatcher());
     $manager->setAsGlobal();
     $manager->bootEloquent();
 }
開發者ID:canaan5,項目名稱:innovating,代碼行數:11,代碼來源:DatabaseServiceprovider.php

示例7: prepareDatabase

 public static function prepareDatabase()
 {
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'geo', 'username' => 'root', 'password' => 'iGlL]m1B', 'charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '']);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
開發者ID:roohbakhshmasoud,項目名稱:location,代碼行數:8,代碼來源:db.php

示例8: configureDatabase

 /**
  * Configure in memory database.
  */
 protected function configureDatabase()
 {
     $db = new DB();
     $db->addConnection(array('driver' => 'sqlite', 'database' => ':memory:', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => ''));
     $db->setEventDispatcher(new Dispatcher(new Container()));
     $db->bootEloquent();
     $db->setAsGlobal();
 }
開發者ID:iolson,項目名稱:support,代碼行數:11,代碼來源:UuidTraitTest.php

示例9: connectToDatabase

 public static function connectToDatabase($hostname, $database, $username, $password)
 {
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'mysql', 'host' => $hostname, 'database' => $database, 'username' => $username, 'password' => $password, 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
開發者ID:loganhenson,項目名稱:core,代碼行數:8,代碼來源:Core.php

示例10: configureDB

 public function configureDB(array $options)
 {
     $capsule = new Capsule();
     $capsule->addConnection($options);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
     $this->dbConnected = true;
 }
開發者ID:mastermindg,項目名稱:api-sugar,代碼行數:9,代碼來源:Api.php

示例11: __construct

 public function __construct()
 {
     $capsule = new Capsule();
     $config = C("db");
     $capsule->addConnection(['driver' => $config['type'], 'host' => $config['host'], 'database' => $config['database'], 'username' => $config['username'], 'password' => $config['password'], 'charset' => $config['charset'], 'collation' => $config['collation'], 'prefix' => $config['prefix']]);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
開發者ID:kisshc,項目名稱:frame,代碼行數:9,代碼來源:model.php

示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'pgsql', 'host' => 'localhost', 'database' => 'datoum', 'username' => 'jerome', 'password' => '', 'charset' => 'utf8', 'prefix' => '', 'schema' => 'public']);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
開發者ID:jvelo,項目名稱:datoum,代碼行數:9,代碼來源:DataTest.php

示例13: initDb

 protected function initDb(Capsule $capsule)
 {
     global $dbCreds;
     $capsule->addConnection($dbCreds);
     $capsule->setEventDispatcher(new Dispatcher());
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
     return $capsule;
 }
開發者ID:anthonyvipond,項目名稱:deduper-laravel,代碼行數:9,代碼來源:BaseCommand.php

示例14: setup

 /**
  * Setup all the illuminate magic 
  * 
  * @return $this
  */
 public function setup()
 {
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'mysql', 'host' => getenv('mysql.hostname'), 'database' => getenv('mysql.database'), 'username' => getenv('mysql.username'), 'password' => getenv('mysql.password'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
     return $this;
 }
開發者ID:staffanselander,項目名稱:RestaurangOnlineDevelopmentConsole,代碼行數:14,代碼來源:Database.php

示例15: addConnection

 public static function addConnection()
 {
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'pgsql', 'host' => 'localhost', 'database' => 'instaclone', 'username' => 'postgres', 'password' => 'pass', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']);
     // Set the event dispatcher used by Eloquent models... (optional)
     $capsule->setEventDispatcher(new Dispatcher(new Container()));
     // Make this Capsule instance available globally via static methods... (optional)
     $capsule->setAsGlobal();
     // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
     $capsule->bootEloquent();
 }
開發者ID:mastermindg,項目名稱:api-sugar,代碼行數:11,代碼來源:DBConfig.php


注:本文中的Illuminate\Database\Capsule\Manager::setEventDispatcher方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。