• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Database\ConnectionResolverInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 /**
  * connects the database, saves SQL-Connection, database-name and prefix
  * @param ConnectionResolverInterface $db
  * @throws \ErrorException
  */
 public function __construct(ConnectionResolverInterface $db)
 {
     try {
         /** @var Connection $connection */
         $connection = $db->connection();
         $this->sql = $connection->getPdo();
         $this->db = $connection->getConfig('database');
         $this->pref = $connection->getConfig('prefix');
     } catch (\Exception $e) {
         $this->sql = false;
         $this->error = $e->getMessage();
         throw new \ErrorException('No Connection to Database: ' . $e->getMessage());
     }
 }
开发者ID:frogsystem,项目名称:legacy-bridge,代码行数:19,代码来源:Database.php


示例2: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->resolver->setDefaultConnection($this->getDatabase());
     $this->getSeeder()->run();
 }
开发者ID:pin-cnx,项目名称:orientdb-laravel-5,代码行数:13,代码来源:SeedCommand.php


示例3: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $name = $this->input->getOption('database');
     $total = $this->seeder->seed($this->resolver->connection($name), $this->path);
     if ($total == 0) {
         $this->info('Nothing to seed.');
     }
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:13,代码来源:SeedCommand.php


示例4: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->resolver->setDefaultConnection($this->getDatabase());
     Model::unguarded(function () {
         $this->getSeeder()->__invoke();
     });
 }
开发者ID:bryanashley,项目名称:framework,代码行数:15,代码来源:SeedCommand.php


示例5: handle

 /**
  * @return mixed
  */
 public function handle()
 {
     // TODO: Implement handle() method.
     if (!$this->confirmToProceed()) {
         return;
     }
     $this->resolver->setDefaultConnection($this->getDatabase());
     Model::unguarded(function () {
         $this->getSeeder()->run();
     });
 }
开发者ID:filipveschool,项目名称:packagegenerator,代码行数:14,代码来源:MakeSeederCommand.php


示例6: handle

 /**
  * @param Request $request
  * @param Closure $next
  * @return mixed
  * @throws \Exception
  */
 public function handle(Request $request, Closure $next)
 {
     $this->connectionResolver->connection()->beginTransaction();
     try {
         $response = $next($request);
     } catch (\Exception $e) {
         $this->connectionResolver->connection()->rollBack();
         throw $e;
     }
     $this->connectionResolver->connection()->commit();
     return $response;
 }
开发者ID:spira,项目名称:api-core,代码行数:18,代码来源:TransactionMiddleware.php


示例7: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $tenants = $this->manager->getRepository()->getTenants();
     $seeder = $this->getSeeder();
     foreach ($tenants as $tenant) {
         $this->manager->bootstrapConnectionByTenantName($tenant->tenant_name);
         $this->resolver->setDefaultConnection($tenant->tenant_name);
         $this->manager->assumeTenant($tenant->id, true);
         $seeder->run();
         $this->output->writeln('<info>Seeded tenant ' . $tenant->tenant_name . '</info>');
         $this->manager->restoreTenant();
     }
 }
开发者ID:stillat,项目名称:database,代码行数:18,代码来源:SeedCommand.php


示例8: setConnection

 /**
  * Set the default connection name.
  *
  * @param  string  $name
  * @return void
  */
 public function setConnection($name)
 {
     if (!is_null($name)) {
         $this->resolver->setDefaultConnection($name);
     }
     $this->repository->setSource($name);
     $this->connection = $name;
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:14,代码来源:Migrator.php


示例9: table

 /**
  * Get a query builder for the given table.
  *
  * @param  string  $table
  * @return \Illuminate\Database\Query\Builder
  */
 protected function table($table)
 {
     return $this->db->connection($this->connection)->table($table);
 }
开发者ID:rosskmurphy,项目名称:Laravel-4-login-registration,代码行数:10,代码来源:DatabasePresenceVerifier.php


示例10: table

 /**
  * Get a query builder for the given table.
  *
  * @param  string  $table
  * @return \Illuminate\Database\Query\Builder
  */
 protected function table($table)
 {
     return $this->db->connection($this->connection)->table($table)->useWritePdo();
 }
开发者ID:bryanashley,项目名称:framework,代码行数:10,代码来源:DatabasePresenceVerifier.php


示例11: getConnection

 /**
  * Get the connection.
  *
  * @return \Illuminate\Database\ConnectionInterface
  */
 protected function getConnection()
 {
     return $this->resolver->connection($this->connectionName);
 }
开发者ID:appotter,项目名称:oauth2-server-msp,代码行数:9,代码来源:AbstractFluentAdapter.php


示例12: resolveConnection

 /**
  * Resolve a connection instance by name.
  *
  * @param  string  $connection
  * @return Illuminate\Database\Connection
  */
 public static function resolveConnection($connection)
 {
     return static::$resolver->connection($connection);
 }
开发者ID:hochanh,项目名称:Bootsoft-Bowling,代码行数:10,代码来源:Model.php


示例13: microtime

 function it_should_get_connection_for_source()
 {
     $connection = microtime();
     $this->resolver->connection($this->source)->willReturn($connection);
     $this->getConnection()->shouldBe($connection);
 }
开发者ID:mtahv3,项目名称:SmartSeeder,代码行数:6,代码来源:SmartSeederRepositorySpec.php


示例14: connect

 /**
  * Establish a queue connection.
  *
  * @param  array  $config
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     return new DatabaseQueue($this->connections->connection(array_get($config, 'connection')), array_get($config, 'table', 'queues'), array_get($config, 'queue', null), array_get($config, 'expire', 60), array_get($config, 'lock_type', 60));
 }
开发者ID:brucewu16899,项目名称:laravel-database-queue,代码行数:10,代码来源:DatabaseConnector.php


示例15: errorException

 /**
  * @Transactional(value="testing",expect=\LogicException::class)
  *
  * @return string
  */
 public function errorException()
 {
     $this->db->connection()->statement('CREATE TABLE tests (test varchar(255) NOT NULL)');
     $this->db->connection()->table("tests")->insert(['test' => 'testing']);
     throw new \LogicException();
 }
开发者ID:ytake,项目名称:laravel-aspect,代码行数:11,代码来源:AspectTransactionalDatabase.php


示例16: connect

 /**
  * Establish a queue connection.
  *
  * @param  array  $config
  * @return \Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     return new DatabaseQueue($this->connections->connection(Arr::get($config, 'connection')), $config['table'], $config['queue'], Arr::get($config, 'expire', 60));
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:10,代码来源:DatabaseConnector.php


示例17: getConnection

 /**
  * Resolve the database connection instance.
  *
  * @return \Illuminate\Database\Connection
  */
 public function getConnection()
 {
     return $this->resolver->connection($this->connection);
 }
开发者ID:asifalimd,项目名称:core,代码行数:9,代码来源:DatabaseMigrationRepository.php


示例18: getTable

 /**
  * Get a new query builder instance for the table.
  *
  * @return \Illuminate\Database\Query\Builder
  */
 protected function getTable()
 {
     return $this->resolver->connection($this->database)->table($this->table);
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:9,代码来源:DatabaseFailedJobProvider.php


示例19: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->resolver->setDefaultConnection($this->getDatabase());
     $this->getSeeder()->run();
 }
开发者ID:flelievre,项目名称:EasyVisit,代码行数:10,代码来源:SeedCommand.php


示例20: connect

 /**
  * @param array $config
  *
  * @return CouchbaseQueue|\Illuminate\Contracts\Queue\Queue
  */
 public function connect(array $config)
 {
     /** @var CouchbaseConnection $connection */
     $connection = $this->connectionResolver->connection($config['driver']);
     return new CouchbaseQueue($connection, $config['bucket'], $config['queue'], Arr::get($config, 'retry_after', 60));
 }
开发者ID:ytake,项目名称:laravel-couchbase,代码行数:11,代码来源:CouchbaseConnector.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Database\DatabaseManager类代码示例发布时间:2022-05-23
下一篇:
PHP Database\ConnectionInterface类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap