本文整理汇总了PHP中Illuminate\Database\Query\Builder::groupBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::groupBy方法的具体用法?PHP Builder::groupBy怎么用?PHP Builder::groupBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Query\Builder
的用法示例。
在下文中一共展示了Builder::groupBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: groupBy
public function groupBy()
{
foreach (func_get_args() as $column) {
$this->groups[] = is_string($column) ? snake_case($column) : $column;
}
return parent::groupBy();
// TODO: Change the autogenerated stub
}
示例3: groupBy
/**
* Add a "group by" clause to the query.
*
* @param array|string $column,...
* @return $this
* @static
*/
public static function groupBy()
{
return \Illuminate\Database\Query\Builder::groupBy();
}
示例4: 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__');
}
示例5: apply
/**
* Modify a Builder object. Changes here can be nested
* @param \Illuminate\Database\Query\Builder $query
* @return \Illuminate\Database\Query\Builder $query
*/
public function apply(\Illuminate\Database\Query\Builder $query)
{
return $query->groupBy('test_users.id')->having('test_posts.views', '>=', $this->views);
}
示例6: groupBy
public function groupBy($field)
{
$this->_operator->groupBy($field);
return $this;
}
示例7: execute
public function execute(Builder $query)
{
foreach ($this->getValuesIterator() as $groupBy) {
$query->groupBy($groupBy->getValue());
}
return $query;
}