protected function buildWhere() { if ($this->whereBuilt) { return; } foreach ($this->filterClosures as $closure) { if (empty($this->filters)) { $this->query .= ' WHERE'; } Filter::$collection = $this; $closure($this); Filter::reset(); } if ($this->groupBy) { $this->query .= ' ' . $this->groupBy->getQuery(); } $this->whereBuilt = true; }