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


PHP ConnectionResolverInterface::connection方法代码示例

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


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

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

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

示例3: __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

示例4: resolveConnection

 /**
  * Resolve the database connection instance.
  *
  * @param  string  $connection
  * @return \Illuminate\Database\Connection
  */
 public function resolveConnection($connection)
 {
     return $this->resolver->connection($connection);
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:10,代码来源:Migrator.php

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

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

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

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

示例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)->useWritePdo();
 }
开发者ID:bryanashley,项目名称:framework,代码行数:10,代码来源:DatabasePresenceVerifier.php

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

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

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

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

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

示例15: 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::connection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。