Skip to content

Commit

Permalink
Merge pull request #118 from pavelhouzva/pagination
Browse files Browse the repository at this point in the history
added pagination to collection
  • Loading branch information
dirkgroenen authored Sep 8, 2021
2 parents c043363 + a2b8679 commit 1dee44d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Pinterest/Models/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ public function hasNextPage()
return ($this->response != null && isset($this->response->page['next']));
}

public function nextPage()
{
if ($this->hasNextPage()) {
$response = $this->master->request->execute('GET', $this->response->page['next']);
return new self($this->master, $response, $this->model);
}
}

/**
* Return the item at the given index
*
Expand Down Expand Up @@ -255,4 +263,4 @@ public function getIterator() {
return new \ArrayIterator($this->items);
}

}
}

0 comments on commit 1dee44d

Please sign in to comment.