Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/Traits/WithData.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,23 @@
$this->paginationTotalItemCount = $this->getBuilder()->count();

return $this->getBuilder()->simplePaginate($this->getPerPage() === -1 ? $this->paginationTotalItemCount : $this->getPerPage(), ['*'], $this->getComputedPageName());
} else {
$this->paginationTotalItemCount = -1;

return $this->getBuilder()->simplePaginate($this->getPerPage() === -1 ? 10 : $this->getPerPage(), ['*'], $this->getComputedPageName());
}

$this->paginationTotalItemCount = -1;

Check warning on line 112 in src/Traits/WithData.php

View check run for this annotation

Codecov / codecov/patch

src/Traits/WithData.php#L112

Added line #L112 was not covered by tests

return $this->getBuilder()->simplePaginate($this->getPerPage() === -1 ? 10 : $this->getPerPage(), ['*'], $this->getComputedPageName());

Check warning on line 114 in src/Traits/WithData.php

View check run for this annotation

Codecov / codecov/patch

src/Traits/WithData.php#L114

Added line #L114 was not covered by tests

} elseif ($this->isPaginationMethod('cursor')) {

$this->paginationTotalItemCount = $this->getBuilder()->count();
if ($this->getShouldRetrieveTotalItemCount()) {
$this->paginationTotalItemCount = $this->getBuilder()->count();

Check warning on line 119 in src/Traits/WithData.php

View check run for this annotation

Codecov / codecov/patch

src/Traits/WithData.php#L118-L119

Added lines #L118 - L119 were not covered by tests

return $this->getBuilder()->cursorPaginate($this->getPerPage() === -1 ? $this->paginationTotalItemCount : $this->getPerPage(), ['*'], $this->getComputedPageName());

Check warning on line 121 in src/Traits/WithData.php

View check run for this annotation

Codecov / codecov/patch

src/Traits/WithData.php#L121

Added line #L121 was not covered by tests
}

$this->paginationTotalItemCount = -1;

Check warning on line 124 in src/Traits/WithData.php

View check run for this annotation

Codecov / codecov/patch

src/Traits/WithData.php#L124

Added line #L124 was not covered by tests

return $this->getBuilder()->cursorPaginate($this->getPerPage() === -1 ? $this->paginationTotalItemCount : $this->getPerPage(), ['*'], $this->getComputedPageName());
return $this->getBuilder()->cursorPaginate($this->getPerPage() === -1 ? 10 : $this->getPerPage(), ['*'], $this->getComputedPageName());

Check warning on line 126 in src/Traits/WithData.php

View check run for this annotation

Codecov / codecov/patch

src/Traits/WithData.php#L126

Added line #L126 was not covered by tests
} else {
throw new DataTableConfigurationException('Pagination method must be either simple, standard or cursor');
}
Expand Down
Loading