Skip to content

Commit

Permalink
paginator fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sykorax committed Jun 18, 2019
1 parent cabe972 commit d458da2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Internal/Builders/AbstractBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


use Illuminate\Support\Collection;
use function is_array;

/**
* Class AbstractBuilder
Expand Down Expand Up @@ -45,7 +46,7 @@ public static function make(callable $cb)
*/
public function __call($name, $arguments)
{
$this->params[$name] = $arguments[0];
$this->params[$name] = is_array($arguments) ? $arguments[0] : $arguments;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/Internal/Builders/Paginated.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ public function walkThrough(callable $cb, $until = null)
* @param int $page
* @param int $perPage
*
* @return mixed
* @return \Illuminate\Support\Collection
*/
public function page(int $page, int $perPage = null)
{
if ($perPage) {
$this->paginate($perPage);
}
return $this->limitStart(($page - 1) * $this->perRequest)->retrieve();
return $this->limitStart(
(($page - 1) * $this->perRequest) + 1
)->retrieve();
}

/**
Expand Down

0 comments on commit d458da2

Please sign in to comment.