本文整理匯總了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;
}