- Merge with Mssql repository bugfix
This commit is contained in:
1 parent
724ab250ab
commit
e1990e7cc0
11 files changed
+95
-87
No files matched your search
@@ -15,7 +15,17 @@ trait SearchRequestPaginationTrait {
|
||||
public bool $skipCount = false;
|
||||
|
||||
public ? array $columns = null;
|
||||
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
public function page(): int
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
public function limit(): int
|
||||
{
|
||||
return $this->limit;
|
||||
@@ -23,7 +33,7 @@ trait SearchRequestPaginationTrait {
|
||||
|
||||
public function offset(): int
|
||||
{
|
||||
return (int) ( abs( ( $this->page - 1 ) * $this->limit() ) );
|
||||
return (int) ( abs( ( $this->page() - 1 ) * $this->limit() ) );
|
||||
}
|
||||
|
||||
public function pagination(int $page, int $itemCount) : void
|
||||
@@ -34,17 +44,25 @@ trait SearchRequestPaginationTrait {
|
||||
|
||||
public function pageCount() : int
|
||||
{
|
||||
return ceil($this->count / $this->limit());
|
||||
return ceil($this->count() / $this->limit());
|
||||
}
|
||||
|
||||
public function hasPagination() : int
|
||||
{
|
||||
return $this->pageCount() > 1;
|
||||
}
|
||||
|
||||
public function skipCount(bool $value) : self
|
||||
{
|
||||
$this->skipCount = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function resultShown() : int
|
||||
{
|
||||
$total = $this->page() * $this->limit();
|
||||
|
||||
return $total <= $this->count() ? $total : $this->count();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user