paginate

An essential function for auto pagination of the record.

Usage:

$db->{table}->paginate($pagination);

Example:

Basic Pagination

$paginate = array(
    'page' => 1,
    'limit' => 10
);
$news = $db->news->paginate($paginate);

Pagination with where conditions

$paginate = array(
    'page' => 1,
    'limit' => 10,
    'where' => array('name' => 'My Test')
);
$news = $db->news->paginate($paginate);

Returns:

[
    {
        "id": "1",
        "name": "Test News",
        "status": "ACTIVE",
        "created_at": "2024-11-03 21:07:37",
        "updated_at": null,
        "deleted_at": null
    },
    ...
]

Looking for the other parameters?

Parameters

Last updated