Menu

## PaginationCore
in package

PaginationCore.php : 10

### Table of Contents

#### Properties

$limit : int
$offset : int
$baseQuery : Join|Builder|null
$db : string|null
$parged : array<string|int, mixed>
$reqData : array<string|int, mixed>
$table : string

#### Methods

__construct() : mixed
columns() : $this
  Sets the columns to return in the query
init() : PaginationCore
paginate() : array<string|int, mixed>|null
  Should be called finally to get the paginated data.
where() : PaginationCore
extractPagination() : array<string|int, mixed>
  Picks the pagination data from the request. Pagination data can be defined in the `PAGINATION` key or the `pagination` key.

### Properties

#### $limit

PaginationCore.php : 12
`public int $limit = 10`

#### $offset

PaginationCore.php : 14
`public int $offset = 0`

#### $baseQuery

PaginationCore.php : 24
`private Join|Builder|null $baseQuery = null`

#### $db

PaginationCore.php : 16
`private string|null $db = null`

#### $parged

PaginationCore.php : 20
`private array<string|int, mixed> $parged = ['columns' => '*', 'where' => []]`

#### $reqData

PaginationCore.php : 18
`private array<string|int, mixed> $reqData = []`

#### $table

PaginationCore.php : 22
`private string $table`

### Methods

#### __construct()

PaginationCore.php : 26
`public __construct(array<string|int, mixed>|null $reqData, string $table[, int|null $limit = 10 ][, int|null $offset = 0 ][, string|null $db = 'db' ]) : mixed`

##### Parameters

$reqData : array<string|int, mixed>|null
$table : string
$limit : int|null = 10
$offset : int|null = 0
$db : string|null = 'db'

#### columns()

PaginationCore.php : 48

Sets the columns to return in the query

`public columns([string|array<string|int, mixed> $columns = "*" ]) : $this`

##### Parameters

$columns : string|array<string|int, mixed> = "*"

##### Return values

$this

#### init()

PaginationCore.php : 57
`public init(callable $callback) : PaginationCore`

##### Parameters

$callback : callable

##### Tags

throws
  Exception

##### Return values

PaginationCore

#### paginate()

PaginationCore.php : 78

Should be called finally to get the paginated data.

`public paginate([array<string|int, mixed>|null $where = null ][, array<string|int, mixed>|null $joins = null ]) : array<string|int, mixed>|null`

Supports where clause just like the `where` method in the Porm query builder

##### Parameters

$where : array<string|int, mixed>|null = null
$joins : array<string|int, mixed>|null = null

##### Tags

throws
  BaseDatabaseException
throws
  Exception

##### Return values

array<string|int, mixed>|null

#### where()

PaginationCore.php : 37
`public where([array<string|int, mixed> $where = [] ]) : PaginationCore`

##### Parameters

$where : array<string|int, mixed> = []

##### Return values

PaginationCore

#### extractPagination()

PaginationCore.php : 131

Picks the pagination data from the request. Pagination data can be defined in the `PAGINATION` key or the `pagination` key.

`private extractPagination() : array<string|int, mixed>`

You can also define them in the `SEARCH` key or the `search` key.

Pagination usually is comprised of the `limit` and `offset` or `LIMIT` and `OFFSET` keys.

If none can't be found, it implies the request is new, so the default values are used.

##### Return values

array<string|int, mixed>

## Search results