Add a "group by" clause to the query.

@param  array  $groups
@return $this
504802
public function groupBy($groups)
    {
        $groups = (array) $groups;

        foreach ($groups as $group) {
            $this->groups = array_merge($this->groups, Arr::wrap($group));
        }

        return $this;
    }
753742
public function setGroups($groups)
    {
        $this->hasGroupsProperty();

        $this->groups = $groups instanceof ArrayCollection ?
            $groups :
            new ArrayCollection($groups);
    }
411391
public function updateGroup(array $groups)
    {
        $groups = json_encode($groups, JSON_UNESCAPED_UNICODE);

        return $this->auth(function () use ($groups) {
            return $this->http->postJson(
                $this->baseUrl . 'cgi-bin/groups/update?access_token=' . $this->accessToken,
                $groups
            );
        });
    }
182089
public function setGroup($group)
    {
        if (!empty($group)) {
            $this->query['group'] = $group;
        } else {
            unset($this->query['group']);
        }
        return $this;
    }
160686
public function hasGroups($groups)
    {
        if ($this->user() === null) {
            return null;
        }

        if (!is_array($groups)) {
            $groups = func_get_args();
        }

        // Count roles because user need user to have all roles passed as parameter
        return count(array_intersect($groups, $this->groups)) === count($groups);
    }
1264795
public function addGroup(...$groups)
    {
        collect($groups)->map(function ($group) {
            $this->route['groups'][] = $group->get();
        });

        return $this;
    }
56076
public function addGrouping( $grouping )
	{
		if( is_array( $grouping ) )
			return $this->addGroupings( $grouping );
		if( in_array( $grouping, $this->groupings ) )
			return FALSE;
		$this->groupings[] = $grouping;
		return TRUE;
	}
458676
public function addFilters(array $filters)
    {
        foreach ($filters as $filter) {
            if ($filter instanceof QueryDSL) {
                $this->addFilter($filter);
            }
        }
        return $this;
    }
694026
public function group($columns)
    {
        if (null === $this->group) {
            $this->group = $this->element('GROUP BY', $columns);
        } else {
            $this->group->append($columns);
        }

        return $this;
    }
1139127
public function groupBy($fields)
    {
        $fields = is_array($fields) ? $fields : func_get_args();
        $this->groupBy = array_merge($this->groupBy, $fields);
        return $this;
    }
134784
public function group($group){
        if(is_array($group)){
            $this->group= 'GROUP BY ';
            foreach ($group as $value) {
                $this->group .= $value.',';
            }
            $this->group= rtrim($this->group, ',');
            $this->group.=' ';
        }else{
            $this->group= 'GROUP BY '.$group.' ';
        }
    }
959403
public function group($fields)
    {
        if (!$fields) {
            return $this;
        }
        if ($fields = is_array($fields) ? $fields : func_get_args()) {
            $this->_parts['group'] = array_merge($this->_parts['group'], array_fill_keys($fields, true));
        }
        return $this;
    }
1297352
public function groupBy($field)
    {
        $field = $this->addTablePrefix($field);
        $this->addStatement('groupBys', $field);
        return $this;
    }
1211877
public function groupBy(array $columns) {
		// for each given parameter
		foreach($columns as $column) {
			// secure the column name
			list($column) = Query\Convert::columnToPlaceholder($this->Quote ,$column);
			// push it
			$this->Groups[] = $column;
		}
		// return self to the next method
		return $this;
	}
736548
public function GroupBy($Fields = NULL) {
      if(is_null($Fields)) {
         // Group by every item in the select that isn't a function.
         foreach($this->_Selects as $Alias => $Select) {
            if(ArrayValue('Function', $Select) == '') {
               $this->_GroupBys[] = $Select['Field'];
            }
         }
         return $this;
      }
      
      if (is_string($Fields))
         $Fields = explode(',', $Fields);

      foreach ($Fields as $Field) {
         $Field = trim($Field);

         if ($Field != '')
            $this->_GroupBys[] = $this->EscapeIdentifier($Field);
      }
      return $this;
   }
343631
public function GroupBy($fields): QueryBuilder
    {
        if (is_array($fields)) {
            $fields = implode(', ', $field);
        }
        
        $this->group_by = $fields;
        
        return $this;
    }
332514
public function group_by( $key ) 
	{
		if ( !is_array( $key ) )
		{
			$key = array( $key );	
		}
		
		foreach( $key as $group_key )
		{
			$this->groups[] = $group_key;
		}
		
		return $this;
	}