当前位置: 首页>>代码示例>>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;未经允许,请勿转载。