Skip to content

Commit

Permalink
fixed pagination query on searchable builder
Browse files Browse the repository at this point in the history
  • Loading branch information
jarektkaczyk committed Apr 22, 2017
1 parent 070d7e0 commit 6f821bc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,20 @@ protected function restoreFieldsForCount()

$this->backups = $this->bindingBackups = [];
}

/**
* Run a pagination count query.
*
* @param array $columns
* @return array
*/
protected function runPaginationCountQuery($columns = ['*'])
{
$bindings = $this->from instanceof Subquery ? ['order'] : ['select', 'order'];

return $this->cloneWithout(['columns', 'orders', 'limit', 'offset'])
->cloneWithoutBindings($bindings)
->setAggregate('count', $this->withoutSelectAliases($columns))
->get()->all();
}
}

0 comments on commit 6f821bc

Please sign in to comment.