All pages
Powered by GitBook
1 of 1

Loading...

Limit, Offset, and Pagination

limit

Name

Type

Required

Default

Description

value

Sets the limit value for the query.

take

Sets the limit value for the query. Alias for .

offset

Sets the offset value for the query.

forPage

Helper method to calculate the limit and offset given a page number and count per page.

simplePaginate & paginate

This method combines forPage, count, and get to create a pagination struct alongside the results. Information on the simplePaginate or paginate methods, including custom pagination collectors, can be found in the section of the documentation.

numeric

true

The limit value for the query.

Name

Type

Required

Default

Description

value

numeric

true

The limit value for the query.

Name

Type

Required

Default

Description

value

numeric

true

The offset value for the query.

Name

Type

Required

Default

Description

page

numeric

true

The page number to retrieve.

maxRows

numeric

true

limit
Retreiving Results

The number of records per page. If a number less than 0 is passed, 0 is used instead.

QueryBuilder
query.from( "users" )
    .limit( 5 );
MySQL
SELECT *
FROM `users`
LIMIT 5
QueryBuilder
query.from( "users" )
    .take( 5 );
MySQL
SELECT *
FROM `users`
LIMIT 5
QueryBuilder
query.from( "users" )
    .offset( 25 );
MySQL
SELECT *
FROM `users`
OFFSET 25
QueryBuilder
query.from( "users" )
    .forPage( 3, 15 );
MySQL
SELECT *
FROM `users`
LIMIT 15
OFFSET 30