/** * Depending on the sorted column this will add orderBy to the builder. */ protected function addOrderBy() { if (static::$versionTransformer->isOrdered()) { foreach (static::$versionTransformer->getOrderedColumns() as $index => $direction) { if (isset($this->columnNames[$index])) { $this->builder->orderBy($this->columnNames[$index], $direction); } } } }