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


PHP Manager::bootEloquent方法代码示例

本文整理汇总了PHP中Illuminate\Database\Capsule\Manager::bootEloquent方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::bootEloquent方法的具体用法?PHP Manager::bootEloquent怎么用?PHP Manager::bootEloquent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Capsule\Manager的用法示例。


在下文中一共展示了Manager::bootEloquent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 /**
  * Initializes the Eloquent ORM.
  */
 public function initialize()
 {
     $this->capsule->bootEloquent();
     if ('default' !== $this->defaultConnection) {
         $this->capsule->getDatabaseManager()->setDefaultConnection($this->defaultConnection);
     }
 }
开发者ID:wouterj,项目名称:eloquent-bundle,代码行数:10,代码来源:EloquentInitializer.php

示例2: init

 public function init()
 {
     $this->capsule = new Capsule();
     $this->capsule->addConnection(['driver' => 'mysql', 'host' => DB_HOST, 'port' => DB_PORT, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'charset' => DB_CHARSET, 'collation' => DB_COLLATION]);
     $this->capsule->bootEloquent();
     $this->capsule->setAsGlobal();
 }
开发者ID:joppuyo,项目名称:Dullahan,代码行数:7,代码来源:Migration.php

示例3: initialize

 /**
  * Initializes the connection manager and its dependencies.
  */
 protected function initialize()
 {
     $this->capsule = new Capsule();
     $this->capsule->setEventDispatcher(new Dispatcher(new Container()));
     $this->capsule->setAsGlobal();
     $this->capsule->bootEloquent();
 }
开发者ID:larrytech,项目名称:calendar,代码行数:10,代码来源:Connector.php

示例4: _makeEloquent

 /**
  * Setup eloquent database
  * @param \Illuminate\Database\Capsule\Manager $capsule
  * @throws \Lassi\App\Exception\NotFoundException
  * @return \Lassi\App\Database
  */
 private function _makeEloquent(Capsule $capsule)
 {
     // Throw exception if minimum requirements not met
     if (!getenv('db_driver') || !getenv('db_name')) {
         throw new NotFoundException('App configurations not found.');
     }
     // Get capsule instance
     $this->capsule = $capsule;
     // Cache db driver
     $db_driver = getenv('db_driver');
     // Setup connection defaults
     $configs = array('driver' => $db_driver, 'database' => getenv('db_name'), 'prefix' => getenv('db_prefix'), 'charset' => getenv('db_charset'), 'collation' => getenv('db_collation'));
     // Add extras depending on type of driver/connection
     if ($db_driver !== 'sqlite') {
         if (getenv('db_host')) {
             $configs['host'] = getenv('db_host');
         }
         if (getenv('db_username')) {
             $configs['username'] = getenv('db_username');
         }
         if (getenv('db_password')) {
             $configs['password'] = getenv('db_password');
         }
     }
     // Setup connection
     $this->capsule->addConnection($configs);
     // Set as global
     $this->capsule->setAsGlobal();
     // Boot eloquent
     $this->capsule->bootEloquent();
     return $this;
 }
开发者ID:leandrocanabarro,项目名称:lassi,代码行数:38,代码来源:Database.php

示例5: setConnection

 protected function setConnection(array $connection)
 {
     $this->capsule = new Capsule();
     $this->capsule->addConnection($connection);
     $this->capsule->setAsGlobal();
     $this->capsule->bootEloquent();
 }
开发者ID:xandros15,项目名称:aigisu,代码行数:7,代码来源:Connection.php

示例6: 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

示例7: setUpBeforeClass

 /**
  * set up eloquent for test
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     self::$manager = new Manager();
     // TODO: add dotenv and extract for reuse
     self::$manager->addConnection(['driver' => 'mysql', 'host' => 'localhost', 'database' => 'grimm', 'username' => 'homestead', 'password' => 'secret', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null]);
     self::$manager->setAsGlobal();
     self::$manager->bootEloquent();
 }
开发者ID:grimmdevelop,项目名称:models,代码行数:12,代码来源:PersonsTest.php

示例8: createConnection

 protected function createConnection()
 {
     $this->capsule = new Capsule();
     $this->capsule->addConnection(['driver' => 'sqlite', 'database' => __DIR__ . '/db/testing.sqlite', 'prefix' => '']);
     $this->capsule->setFetchMode(PDO::FETCH_CLASS);
     $this->capsule->setAsGlobal();
     $this->capsule->bootEloquent();
     $this->capsule->getConnection()->enableQueryLog();
 }
开发者ID:leloulight,项目名称:trigglog,代码行数:9,代码来源:TestCase.php

示例9: addDbConnection

 /**
  * @param array $credentials
  */
 public function addDbConnection($credentials = [])
 {
     if (empty($credentials)) {
         $bitrixDbCredentials = \Bitrix\Main\Application::getInstance()->getConnection()->getConfiguration();
         $credentials = ['driver' => 'mysql', 'database' => $bitrixDbCredentials['database'], 'username' => $bitrixDbCredentials['login'], 'password' => $bitrixDbCredentials['password'], 'host' => $bitrixDbCredentials['host'], 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false];
     }
     $this->capsule->addConnection($credentials);
     $this->capsule->setAsGlobal();
     $this->capsule->bootEloquent();
 }
开发者ID:osotov,项目名称:illuminate-for-bitrix,代码行数:13,代码来源:Bootstrapper.php

示例10: init

 /**
  * Build console entry point
  * @param array|null $services
  * @throws \Ffcms\Core\Exception\NativeException
  */
 public static function init(array $services = null)
 {
     self::$Properties = new Properties();
     self::$Input = new Input();
     self::$Output = new Output();
     // establish database link
     if (Obj::isArray(self::$Properties->get('database')) && (isset($services['Database']) && $services['Database'] === true || $services === null)) {
         self::$Database = new Capsule();
         self::$Database->addConnection(self::$Properties->get('database'));
         // Make this Capsule instance available globally via static methods... (optional)
         self::$Database->setAsGlobal();
         // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
         self::$Database->bootEloquent();
     }
 }
开发者ID:phpffcms,项目名称:ffcms-console,代码行数:20,代码来源:Console.php

示例11: initCapsule

 /**
  * Init capsule
  */
 public function initCapsule()
 {
     $this->capsule = new Capsule();
     switch ($this->configDatabase['driver']) {
         case 'mysql':
             $configConnection = ['driver' => 'mysql', 'host' => $this->configDatabase['host'], 'database' => $this->configDatabase['database'], 'username' => $this->configDatabase['username'], 'password' => $this->configDatabase['password'], 'charset' => $this->configDatabase['charset'], 'collation' => $this->configDatabase['collation']];
             if (isset($this->configDatabase['prefix'])) {
                 $configConnection['prefix'] = $this->configDatabase['prefix'];
             }
             $this->capsule->addConnection($configConnection);
             break;
     }
     $this->capsule->setAsGlobal();
     $this->capsule->bootEloquent();
 }
开发者ID:Janoski,项目名称:futurtravel,代码行数:18,代码来源:Database.php

示例12: __construct

 public function __construct()
 {
     $config = Tempest::get()->config->get('db');
     if (!empty($config)) {
         $config = array_merge(array('driver' => 'mysql', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci'), $config);
         $connection = $this->parseConnectionString(ObjectUtil::getDeepValue($config, 'connection'));
         $connection = array_merge($config, $connection);
         $this->_capsule = new Manager();
         $this->_capsule->addConnection($connection);
         $this->_capsule->setAsGlobal();
         $this->_capsule->bootEloquent();
     } else {
         throw new Exception('No database connection details were provided by the application.');
     }
 }
开发者ID:martywallace,项目名称:tempest,代码行数:15,代码来源:DatabaseService.php

示例13: setUp

    public function setUp()
    {
        $this->capsule = new \Illuminate\Database\Capsule\Manager();
        $this->capsule->addConnection(['driver' => 'sqlite', 'database' => ':memory:']);
        $this->capsule->setAsGlobal();
        $this->capsule->bootEloquent();
        $ddl = <<<SQL
CREATE TABLE `sessions` (
  `id` varchar(255) NOT NULL UNIQUE,
  `payload` text NOT NULL,
  `last_activity` int(11) NOT NULL
)
SQL;
        $this->capsule->getConnection()->getPdo()->exec($ddl);
    }
开发者ID:yusukezzz,项目名称:slim-session-manager,代码行数:15,代码来源:SessionTest.php

示例14: register

 public function register()
 {
     $this->app->singleton('laravel.db', function ($app) {
         $config = $app['config'];
         // Get the default database from the configuration
         $default = $config['database.default'];
         // Create an capsule instance
         $capsule = new CapsuleManager($app);
         // Override the default value with the user's config value
         $config['database.default'] = $default;
         if (!isset($config['database.connections']) || empty($config['database.connections'])) {
             throw new ConfigurationException("Invalid database configuration");
         }
         $connections = $config['database.connections'];
         foreach ($connections as $name => $connectionConfig) {
             $capsule->addConnection($connectionConfig, $name);
         }
         $capsule->setAsGlobal();
         // Setup the Eloquent ORM...
         if ($config['eloquent.boot'] === true) {
             $capsule->bootEloquent();
         }
         return $capsule->getDatabaseManager();
     });
 }
开发者ID:singularity321,项目名称:Arty,代码行数:25,代码来源:DatabaseServiceProvider.php

示例15: setUpInMemoryDatabase

 private function setUpInMemoryDatabase()
 {
     $capsule = new Capsule();
     $capsule->addConnection(['driver' => 'sqlite', 'database' => ':memory:']);
     $capsule->setAsGlobal();
     $capsule->bootEloquent();
 }
开发者ID:rowofpixels,项目名称:reloadable,代码行数:7,代码来源:TestCase.php


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