Skip to content

Commit

Permalink
Bail on -1
Browse files Browse the repository at this point in the history
  • Loading branch information
aarondfrancis committed Apr 28, 2023
1 parent 92fbfd1 commit e0dc083
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/FastPaginate.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ protected function paginate(string $paginationMethod, Closure $paginatorOutput)
$key = $model->getKeyName();
$table = $model->getTable();

// Apparently some databases allow for offset 0 with no limit and some people
// use it as a hack to get all records. Since that defeats the purpose of
// fast pagination, we'll just return the normal paginator in that case.
// https://github.com/hammerstonedev/fast-paginate/issues/39
if ($perPage === -1) {
return $this->{$paginationMethod}($perPage, $columns, $pageName, $page);
}

try {
$innerSelectColumns = FastPaginate::getInnerSelectColumns($this);
} catch (QueryIncompatibleWithFastPagination $e) {
Expand Down

0 comments on commit e0dc083

Please sign in to comment.