Name | Type | Required | Default | Description |
value | numeric |
| ​ | The limit value for the query. |
Sets the limit value for the query.
QueryBuilderquery.from( "users" ).limit( 5 );
MySQLSELECT *FROM `users`LIMIT 5
Name | Type | Required | Default | Description |
value | numeric |
| ​ | The limit value for the query. |
Sets the limit value for the query. Alias for limit
.
QueryBuilderquery.from( "users" ).take( 5 );
MySQLSELECT *FROM `users`LIMIT 5
Name | Type | Required | Default | Description |
value | numeric |
| ​ | The offset value for the query. |
Sets the offset value for the query.
QueryBuilderquery.from( "users" ).offset( 25 );
MySQLSELECT *FROM `users`OFFSET 25
Name | Type | Required | Default | Description |
page | numeric |
| ​ | The page number to retrieve. |
maxRows | numeric |
| ​ | The number of records per page. If a number less than 0 is passed, 0 is used instead. |
Helper method to calculate the limit and offset given a page number and count per page.
QueryBuilderquery.from( "users" ).forPage( 3, 15 );
MySQLSELECT *FROM `users`LIMIT 15OFFSET 30
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 Retreiving Results section of the documentation.
​