public function groupBy(...$groups) { foreach ($groups as $group) { $this->groups = array_merge((array) $this->groups, is_array($group) ? $group : [$group]); } return $this; }
public function execute(Builder $query) { foreach ($this->getValuesIterator() as $groupBy) { $query->groupBy($groupBy->getValue()); } return $query; }