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


PHP Builder::getQuery方法代码示例

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


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

示例1: checkQueryGroupBy

 protected function checkQueryGroupBy()
 {
     $groups = $this->query->getQuery()->groups;
     $keyGroup = $this->model->getQualifiedKeyName();
     if (empty($groups) || !in_array($keyGroup, $groups)) {
         $this->query->groupBy($keyGroup);
     }
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:8,代码来源:RelationshipQueryJoiner.php

示例2: __construct

 /**
  * EloquentManager constructor.
  *
  * @param Builder|\Eloquent $model
  * @param Request $request
  */
 public function __construct($model, Request $request)
 {
     $this->response = new DataTable();
     $this->query = $model instanceof Builder ? $model : $model->getQuery();
     $this->request = $request;
     //        $this->columns    = $this->query->columns;
     $this->connection = $model->getConnection();
     $this->prefix = $this->connection->getTablePrefix();
     $this->database = $this->connection->getDriverName();
 }
开发者ID:maurob45,项目名称:eloquentdatatables,代码行数:16,代码来源:EloquentManager.php

示例3: count

 /**
  * Counts current query
  *
  * @param string $count variable to store to 'count_all' for iTotalRecords, 'display_all' for iTotalDisplayRecords
  *
  * @return null
  */
 protected function count($count = 'count_all')
 {
     //Get columns to temp var.
     if ($this->query_type == 'eloquent') {
         $query = $this->query->getQuery();
         $connection = $this->query->getModel()->getConnection()->getName();
     } else {
         $query = $this->query;
         $connection = $query->getConnection()->getName();
     }
     // if its a normal query ( no union ) replace the select with static text to improve performance
     $countQuery = clone $query;
     if (!preg_match('/UNION/i', $countQuery->toSql())) {
         $countQuery->select(DB::raw("'1' as row"));
         // if query has "having" clause add select columns
         if ($countQuery->havings) {
             foreach ($countQuery->havings as $having) {
                 if (isset($having['column'])) {
                     $countQuery->addSelect($having['column']);
                 } else {
                     // search filter_columns for query string to get column name from an array key
                     $found = false;
                     foreach ($this->filter_columns as $column => $filter) {
                         if ($filter['parameters'][0] == $having['sql']) {
                             $found = $column;
                             break;
                         }
                     }
                     // then correct it if it's an alias and add to columns
                     if ($found !== false) {
                         foreach ($this->columns as $col) {
                             $arr = preg_split('/ as /i', $col);
                             if (isset($arr[1]) && $arr[1] == $found) {
                                 $found = $arr[0];
                                 break;
                             }
                         }
                         $countQuery->addSelect($found);
                     }
                 }
             }
         }
     }
     // Clear the orders, since they are not relevant for count
     $countQuery->orders = null;
     $this->{$count} = DB::connection($connection)->table(DB::raw('(' . $countQuery->toSql() . ') AS count_row_table'))->setBindings($countQuery->getBindings())->count();
 }
开发者ID:khaidirh,项目名称:laravel4-datatables-package,代码行数:54,代码来源:Datatables.php

示例4: methodExists

 /**
  * Return whether the method
  * exists on the query or not.
  *
  * @param $name
  * @return bool
  */
 protected function methodExists($name)
 {
     return method_exists($this->query->getQuery(), $name);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:11,代码来源:EloquentCriteria.php

示例5: scopeSearchByFeature

 /**
  * Generic query used by scopes, but you can call it with custom feataure codes.
  *
  * @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query
  * @param String $name
  * @param String $feature_class The 1 character feature class
  * @param array $featureCodes List of feature codes to use when returning results
  * @return \Illuminate\Database\Query\Builder
  */
 public function scopeSearchByFeature($query, $name = null, $feature_class = null, $featureCodes = null)
 {
     $table = 'geonames_geonames';
     if (!isset($query->getQuery()->columns)) {
         $query = $query->addSelect($this->usefulScopeColumns);
     }
     if ($name !== null) {
         $query = $query->where($table . '.name', 'LIKE', $name);
     }
     $query = $query->where($table . '.feature_class', $feature_class)->whereIn($table . '.feature_code', $featureCodes);
     return $query;
 }
开发者ID:yurtesen,项目名称:geonames,代码行数:21,代码来源:GeonamesGeoname.php

示例6: removeGroupBy

 /**
  * Remove the GROUP BY clause from a builder.
  *
  * @param Builder|QueryBuilder $builder
  * @return Builder|QueryBuilder $builder with the groups property set to null.
  */
 private function removeGroupBy($builder)
 {
     // Handle \Illuminate\Database\Eloquent\Builder
     if ($builder instanceof Builder) {
         $query = $builder->getQuery();
         $query->groups = null;
         $builder->setQuery($query);
     } else {
         $builder->groups = null;
     }
     return $builder;
 }
开发者ID:MehmetNuri,项目名称:faveo-helpdesk,代码行数:18,代码来源:QueryEngine.php


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