Laravel-DigitalOcean
Laravel-DigitalOcean copied to clipboard
May I ask how to use the built-in pagination more conveniently here?
// create a new result pager
$pager = new DigitalOceanV2\ResultPager($client);
// get all droplets as an array
$droplets = $pager->fetchAll($client->droplet(), 'getAll');
// get all droplets as a Generator which lazily yields
// new results as they become available
$droplets = $pager->fetchAllLazy($client->droplet(), 'getAll');
I tried this method and it works.
$client = app('digitalocean.connection');
$pager = new ResultPager($client);
$droplets = $pager->fetchAll($client->droplet(), 'getAll', ['tag' => 'test']);