trait Pagination

Properties

string $paginationTheme

The pagination theme to use (e.g. 'tailwind', 'bootstrap').

int|string $perPage

Number of items per page.

string $perPageDisplay

Display value for per page selector.

string[] $perPageOptions

Available options for items per page.

bool $with_pagination

Whether pagination is enabled.

int|null $currentPageNumber

Current page number.

int|false $forcePageNumber

Force a specific page number.

Methods

void
updatedPerPageDisplay(string|int $value)

Update the per-page display value.

void
usePagination(bool $bool)

Enable or disable pagination.

void
setPerPageDefault(int $number)

Set the default items per page.

void
setPerPageOptions(array $array)

Set available per-page options.

LengthAwarePaginator
paginateData()

specific method to handle pagination logic.

LengthAwarePaginator
getPageData(int $currentPage)

Get paginated data for a specific page number.

Details

at line 66
void updatedPerPageDisplay(string|int $value)

Update the per-page display value.

Handles the 'Total' option to show all records. Resets selection when page size changes.

Parameters

string|int $value

Return Value

void

at line 87
void usePagination(bool $bool)

Enable or disable pagination.

Parameters

bool $bool

Return Value

void

at line 98
void setPerPageDefault(int $number)

Set the default items per page.

Parameters

int $number

Passing 0 sets it to 'Total' (all items).

Return Value

void

at line 115
void setPerPageOptions(array $array)

Set available per-page options.

Parameters

array $array

Return Value

void

at line 128
LengthAwarePaginator paginateData()

specific method to handle pagination logic.

Applies search, filters, and sort logic to the query or collection, then paginates the result.

Return Value

LengthAwarePaginator

at line 198
LengthAwarePaginator getPageData(int $currentPage)

Get paginated data for a specific page number.

Used for array-based data sources where we slice the collection manually.

Parameters

int $currentPage

Return Value

LengthAwarePaginator