Skip to content

Commit

Permalink
Pagination update
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrick Peter committed Sep 4, 2023
1 parent d91cf1a commit 3e82cc8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Prior to installing `php-orm-database` get the [Composer](https://getcomposer.or
**Step 1** — update your `composer.json`:
```composer.json
"require": {
"peterson/database": "^4.3.3"
"peterson/database": "^4.3.4"
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/Dummy/dummyUserIni.dum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ max_execution_time = 120
max_input_vars = 1000
max_input_time = 120
memory_limit = 400M
zlib.output_compression = On
zlib.output_compression = Off
default_charset = "utf-8"
;extension=pdo_pgsql
4 changes: 2 additions & 2 deletions src/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ public function get($limit = null)
/**
* Paginate the given query into a simple paginator.
*
* @param int|float|string $perPage
* @param int|string $perPage
* - Supporting numeric string values, which will be internally converted to `int`
*
* @param string $pageParam
Expand All @@ -1356,7 +1356,7 @@ public function paginate($perPage = 15, $pageParam = 'page')
$totalCount = $this->countBuilder('*', false);

// new paginator class
$paginator = new Paginator($pageParam,);
$paginator = new Paginator($pageParam);

$this->setMethod(__FUNCTION__);

Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Pagination/Paginator.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private function resetKeys(?array $options = [], $links = true)
*
* @return $this
*/
protected function getPagination($totalCount, int $perPage = 15, Builder $query = null)
protected function getPagination($totalCount, int|string $perPage = 15, Builder $query = null)
{
try {
// convert to int
Expand Down
8 changes: 5 additions & 3 deletions src/Schema/Pagination/PaginatorAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ public static function views(string $mode = null)
*/
public static function headerControlNoCache()
{
@header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
@header("Pragma: no-cache");
@header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
if (!headers_sent()) {
@header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
@header("Pragma: no-cache");
@header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
}
}

/**
Expand Down

0 comments on commit 3e82cc8

Please sign in to comment.