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


PHP Database\ConnectionInterface类代码示例

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


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

示例1: __construct

 public function __construct(ConnectionInterface $connection, $table, array $to_db, array $types, array $scopes)
 {
     $this->grammar = $connection->getQueryGrammar();
     $this->grammar->to_db = $to_db;
     $this->to_db = $to_db;
     $this->types = $types;
     $this->scopes = $scopes;
     $this->builder = $connection->table($table);
 }
开发者ID:bapcat,项目名称:remodel,代码行数:9,代码来源:GatewayQuery.php

示例2: __construct

 /**
  * Create a new query builder instance.
  *
  * @param  \Illuminate\Database\ConnectionInterface  $connection
  * @param  \Illuminate\Database\Query\Grammars\Grammar  $grammar
  * @param  \Illuminate\Database\Query\Processors\Processor  $processor
  * @return void
  */
 public function __construct(ConnectionInterface $connection, Grammar $grammar = null, Processor $processor = null)
 {
     $this->connection = $connection;
     $this->grammar = $grammar ?: $connection->getQueryGrammar();
     $this->processor = $processor ?: $connection->getPostProcessor();
 }
开发者ID:teckwei1993,项目名称:laravel-in-directadmin,代码行数:14,代码来源:Builder.php

示例3: run

 protected function run()
 {
     $config = ['o_cur_version' => Core::version(), 'o_board_title' => '', 'o_board_desc' => '', 'o_time_format' => 'H:i:s', 'o_date_format' => 'Y-m-d', 'o_show_version' => 0, 'o_default_user_group' => 4];
     foreach ($config as $name => $value) {
         $this->database->table('config')->insert(['conf_name' => $name, 'conf_value' => $value]);
     }
 }
开发者ID:fluxbb,项目名称:installer,代码行数:7,代码来源:CreateConfig.php

示例4: save

 public function save()
 {
     // New and changed keys
     $changed = array_diff_assoc($this->data, $this->original);
     $insertValues = array();
     foreach ($changed as $name => $value) {
         if (!array_key_exists($name, $this->original)) {
             $insertValues[] = array('conf_name' => $name, 'conf_value' => $value);
             unset($changed[$name]);
         }
     }
     if (!empty($insertValues)) {
         $this->database->table('config')->insert($insertValues);
     }
     foreach ($changed as $name => $value) {
         $this->database->table('config')->where('conf_name', '=', $name)->update(array('conf_value' => $value));
     }
     // Deleted keys
     $deletedKeys = array_keys(array_diff_key($this->original, $this->data));
     if (!empty($deletedKeys)) {
         $this->database->table('config')->whereIn('conf_name', $deletedKeys)->delete();
     }
     // No need to cache old values anymore
     $this->original = $this->data;
     // Delete the cache so that it will be regenerated on the next request
     $this->cache->forget('fluxbb.config');
 }
开发者ID:fluxbb,项目名称:core,代码行数:27,代码来源:ConfigRepository.php

示例5: run

 protected function run()
 {
     $migrationClasses = ['FluxBB\\Migrations\\Install\\Categories', 'FluxBB\\Migrations\\Install\\Config', 'FluxBB\\Migrations\\Install\\Conversations', 'FluxBB\\Migrations\\Install\\ForumPerms', 'FluxBB\\Migrations\\Install\\ForumSubscriptions', 'FluxBB\\Migrations\\Install\\Groups', 'FluxBB\\Migrations\\Install\\GroupPermissions', 'FluxBB\\Migrations\\Install\\Posts', 'FluxBB\\Migrations\\Install\\Sessions', 'FluxBB\\Migrations\\Install\\TopicSubscriptions', 'FluxBB\\Migrations\\Install\\Users'];
     $schema = $this->database->getSchemaBuilder();
     foreach ($migrationClasses as $class) {
         $instance = new $class($schema);
         $instance->up();
     }
 }
开发者ID:fluxbb,项目名称:installer,代码行数:9,代码来源:CreateTables.php

示例6: getList

 /**
  * Retrieve list of locale codes or names keyed by codes.
  *
  * @param  name
  * @return mixed
  */
 public function getList($name = null)
 {
     if ($name) {
         if (strpos($name, '.') !== false) {
             list($column, $path) = explode('.', $name, 1);
             $list = $this->conn->table($this->table)->get([$column, 'code']);
             return array_pluck($list, $path, 'code');
         }
         return $this->conn->table($this->table)->lists($name, 'code');
     } else {
         $codes = $this->conn->table($this->table)->lists('code');
         return array_combine($codes, $codes);
     }
 }
开发者ID:rkgrep,项目名称:laravel-locales,代码行数:20,代码来源:DatabaseLocaleDriver.php

示例7: removeBy

 /**
  * @param array $fields
  */
 public function removeBy(array $fields)
 {
     if (empty($fields)) {
         return;
     }
     $this->connection->table($this->table)->where($fields)->delete();
 }
开发者ID:ProfessorFrancken,项目名称:ProfessorFrancken,代码行数:10,代码来源:IlluminateRepository.php

示例8: retrieveByCredentials

 /**
  * Retrieve a user by the given credentials.
  *
  * @param array $credentials
  *
  * @return AmazonEchoDevice|null
  */
 public function retrieveByCredentials(array $credentials)
 {
     // First we will add each credential element to the query as a where clause.
     // Then we can execute the query and, if we found a user, return it in a
     // generic "user" object that will be utilized by the Guard instances.
     $query = $this->conn->table($this->table);
     foreach ($credentials as $key => $value) {
         if (!tr_contains($key, 'password')) {
             $query->where($key, $value);
         }
     }
     // Now we are ready to execute the query to see if we have an user matching
     // the given credentials. If not, we will just return nulls and indicate
     // that there are no matching users for these given credential arrays.
     $user = $query->first();
     return $this->getGenericUser($user);
 }
开发者ID:develpr,项目名称:alexa-app,代码行数:24,代码来源:DatabaseDeviceProvider.php

示例9: table

 /**
  * 주어진 테이블에 질의할 수 있는 QueryBulider를 생성하여 반환한다.
  * 두번째 파라메터가 true로 지정되면 해당 테이블에 dynamic field가 적용된 테이블로 간주하고, 질의한다.
  *
  * @param string $table      질의할 대상 table, null일 경우 Repository에 지정된 기본 테이블이 사용된다.
  * @param bool   $useDynamic 질의할 때 Xpressengine의 dynamicField를 사용할 것인지의 여부
  *
  * @return Builder
  */
 protected function table($table = null, $useDynamic = null)
 {
     $table = $table === null ? $this->mainTable : $table;
     $useDynamic = $useDynamic === null ? $this->isDynamic : $useDynamic;
     if ($useDynamic) {
         return $this->connection->dynamic($table);
     } else {
         return $this->connection->table($table);
     }
 }
开发者ID:mint-soft-com,项目名称:xpressengine,代码行数:19,代码来源:DatabaseRepositoryTrait.php

示例10: truncate

 /**
  * Truncate all records
  * @return void
  */
 public function truncate()
 {
     if ($this->fireEvent('truncating') === false) {
         return false;
     }
     $this->connection->statement("SET foreign_key_checks=0");
     $this->table()->truncate();
     $this->connection->statement("SET foreign_key_checks=1");
     $this->fireEvent('truncated');
 }
开发者ID:jplata,项目名称:repository,代码行数:14,代码来源:DbStore.php

示例11: aggregateInterval

 /**
  * @param string $func
  * @param string $column
  * @param \anlutro\LaravelRepository\CriteriaInterface[] $criteria
  * @return array
  */
 protected function aggregateInterval($func, $column, array $criteria = [])
 {
     $query = $this->db->table($this->model->getTable());
     $this->interval->applyQuery($query);
     array_map(function ($criteria) use($query) {
         $criteria->apply($query);
     }, $criteria);
     $expression = $this->db->raw("{$func}({$column}) as `__aggregate__`");
     $query->addSelect($expression);
     return $this->interval->parse($query->get(), $this->start, $this->end);
 }
开发者ID:legalweb,项目名称:php-statistics-helper,代码行数:17,代码来源:AbstractEloquentStatisticsProvider.php

示例12: truncate

 /**
  * Truncate all records
  * @return void
  */
 public function truncate()
 {
     if ($this->fireEvent('truncating') === false) {
         return false;
     }
     // This SET statement fails with sqlite
     try {
         $this->connection->statement("SET foreign_key_checks=0");
     } catch (Exception $e) {
         // do nothing
     }
     $this->table()->truncate();
     try {
         $this->connection->statement("SET foreign_key_checks=1");
     } catch (Exception $e) {
         // do nothing
     }
     $this->fireEvent('truncated');
 }
开发者ID:mreschke,项目名称:repository,代码行数:23,代码来源:DbStore.php

示例13: append

 /**
  * Appends the message stream to the event store.
  *
  * @param mixed $identifier                  The aggregate identifier.
  * @param DomainEventStreamInterface $stream The stream of domain messages.
  * @throws LaravelStoreException             When something went wrong
  *                                           during persistence.
  * @return void
  */
 public function append($identifier, DomainEventStreamInterface $stream)
 {
     // No-op to ensure that an error will be thrown early if the ID
     // is not something that can be converted to a string.
     (string) $identifier;
     try {
         $this->connection->beginTransaction();
         // Make the domain messages database friendly..
         $records = $this->streamSerializer->serialize($stream);
         // Now its time to persist them..
         foreach ($records as $record) {
             $this->connection->table($this->tableName)->insert($record);
         }
         $this->connection->commit();
     } catch (\Exception $exception) {
         // Oops, something went wrong
         $this->connection->rollBack();
         $message = 'Error while persisting the domain events';
         throw new LaravelStoreException($message, $exception);
     }
 }
开发者ID:cminor-io,项目名称:laravel-on-broadway-eventstore,代码行数:30,代码来源:LaravelStore.php

示例14: getQuery

 /**
  * Get a fresh query builder instance for the table.
  *
  * @return \Illuminate\Database\Query\Builder
  */
 protected function getQuery()
 {
     return $this->connection->table($this->table);
 }
开发者ID:neo1125,项目名称:petplus_server,代码行数:9,代码来源:DatabaseSessionHandler.php

示例15: table

 /**
  * Get a query builder for the cache table.
  *
  * @return \Illuminate\Database\Query\Builder
  */
 protected function table()
 {
     return $this->connection->table($this->table);
 }
开发者ID:KodiComponents,项目名称:module-core,代码行数:9,代码来源:SqLiteTaggedStore.php


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