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


PHP Builder::selectRaw方法代码示例

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


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

示例1: getQuery

 private function getQuery()
 {
     $concat = [];
     foreach ($this->by as $id) {
         $concat[] = "ifnull(`{$id}`,'')";
     }
     $key = "concat(" . implode(",'-',", $concat) . ") as `__key`";
     $columns = implode(",", array_merge([$key], $this->sync));
     return $this->builder->selectRaw($columns);
 }
开发者ID:ifgroup,项目名称:merger,代码行数:10,代码来源:Merger.php

示例2: searchSelect

 /**
  * Apply relevance select on the subquery.
  *
  * @param  \Sofa\Searchable\Subquery $subquery
  * @param  \Sofa\Searchable\ColumnCollection $columns
  * @param  array $words
  * @return array
  */
 protected function searchSelect(array $columns, array $words)
 {
     $cases = $bindings = [];
     foreach ($columns as $column) {
         list($cases[], $binding) = $this->buildCase($column, $words);
         $bindings = array_merge_recursive($bindings, $binding);
     }
     $select = implode(' + ', $cases);
     $this->query->selectRaw("max({$select}) as relevance", $bindings['select']);
     return $bindings['where'];
 }
开发者ID:jarektkaczyk,项目名称:laravel-searchable,代码行数:19,代码来源:Searchable.php

示例3: selectRaw

 /**
  * Add a new "raw" select expression to the query.
  *
  * @param string $expression
  * @param array $bindings
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function selectRaw($expression, $bindings = array())
 {
     return \Illuminate\Database\Query\Builder::selectRaw($expression, $bindings);
 }
开发者ID:satriashp,项目名称:tour,代码行数:12,代码来源:_ide_helper.php

示例4: selectRaw

 /**
  * Add a new "raw" select expression to the query.
  *
  * @param string $expression
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function selectRaw($expression)
 {
     return \Illuminate\Database\Query\Builder::selectRaw($expression);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:11,代码来源:_ide_helper.php

示例5: scopeUsed

 /**
  * Get tags that have been used more than 3 times and
  * include that count with the tag.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @return \Illuminate\Database\Query\Builder
  */
 public function scopeUsed($query)
 {
     return $query->selectRaw('tags.*, COUNT(id) AS count')->join('post_tag', 'post_tag.tag_id', '=', 'tags.id')->groupBy('slug');
 }
开发者ID:nav2855,项目名称:neontsunami,代码行数:11,代码来源:Tag.php

示例6: applyQuery

 /**
  * @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder $query
  * @return void
  */
 public function applyQuery($query)
 {
     $query->selectRaw($this->getSQLSelect($query->from) . ' as __interval__');
     $query->groupBy('__interval__');
 }
开发者ID:legalweb,项目名称:php-statistics-helper,代码行数:9,代码来源:Interval.php

示例7: addRoleInheritCondition

 /**
  * Add the role inheritence "where" clause to the given query.
  *
  * @param  \Illuminate\Database\Query\Builder  $query
  * @param  \Illuminate\Database\Eloquent\Model  $authority
  * @param  string  $roles
  * @return \Closure
  */
 protected function addRoleInheritCondition(Builder $query, Model $authority, $roles)
 {
     $query->orWhere('level', '<', function ($query) use($authority, $roles) {
         $query->selectRaw('max(level)')->from($roles)->whereExists($this->getAuthorityRoleConstraint($authority));
     });
 }
开发者ID:JosephSilber,项目名称:bouncer,代码行数:14,代码来源:Abilities.php


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