Laravel-DigitalOcean icon indicating copy to clipboard operation
Laravel-DigitalOcean copied to clipboard

May I ask how to use the built-in pagination more conveniently here?

Open augusl opened this issue 1 year ago • 1 comments

// 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');

augusl avatar Mar 05 '25 03:03 augusl

I tried this method and it works.

        $client = app('digitalocean.connection');
        $pager = new ResultPager($client);
        $droplets = $pager->fetchAll($client->droplet(), 'getAll', ['tag' => 'test']);

augusl avatar Mar 05 '25 04:03 augusl