[L6] Update cursor() calls to work with new lazy collections

This commit is contained in:
Dane Everitt 2019-09-04 21:05:46 -07:00
parent 08bdc9705f
commit 1c5b9dbb87
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
5 changed files with 10 additions and 10 deletions

View File

@ -98,7 +98,7 @@ class BulkPowerActionCommand extends Command
$bar = $this->output->createProgressBar($count); $bar = $this->output->createProgressBar($count);
$servers = $this->repository->getServersForPowerAction($servers, $nodes); $servers = $this->repository->getServersForPowerAction($servers, $nodes);
foreach ($servers as $server) { $servers->each(function ($server) use ($action, &$bar) {
$bar->clear(); $bar->clear();
try { try {
@ -117,7 +117,7 @@ class BulkPowerActionCommand extends Command
$bar->advance(); $bar->advance();
$bar->display(); $bar->display();
} });
$this->line(''); $this->line('');
} }

View File

@ -2,9 +2,9 @@
namespace Pterodactyl\Contracts\Repository; namespace Pterodactyl\Contracts\Repository;
use Generator;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface; use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
@ -69,7 +69,7 @@ interface NodeRepositoryInterface extends RepositoryInterface, SearchableInterfa
* @param array $locations * @param array $locations
* @param int $disk * @param int $disk
* @param int $memory * @param int $memory
* @return \Generator * @return \Illuminate\Support\LazyCollection
*/ */
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): Generator; public function getNodesWithResourceUse(array $locations, int $disk, int $memory): LazyCollection;
} }

View File

@ -133,7 +133,7 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter
* @param int[] $servers * @param int[] $servers
* @param int[] $nodes * @param int[] $nodes
* @param bool $returnCount * @param bool $returnCount
* @return int|\Generator * @return int|\Illuminate\Support\LazyCollection
*/ */
public function getServersForPowerAction(array $servers = [], array $nodes = [], bool $returnCount = false); public function getServersForPowerAction(array $servers = [], array $nodes = [], bool $returnCount = false);

View File

@ -2,9 +2,9 @@
namespace Pterodactyl\Repositories\Eloquent; namespace Pterodactyl\Repositories\Eloquent;
use Generator;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\LazyCollection;
use Pterodactyl\Repositories\Concerns\Searchable; use Pterodactyl\Repositories\Concerns\Searchable;
use Illuminate\Contracts\Pagination\LengthAwarePaginator; use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
@ -172,9 +172,9 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
* @param array $locations * @param array $locations
* @param int $disk * @param int $disk
* @param int $memory * @param int $memory
* @return \Generator * @return \Illuminate\Support\LazyCollection
*/ */
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): Generator public function getNodesWithResourceUse(array $locations, int $disk, int $memory): LazyCollection
{ {
$instance = $this->getBuilder() $instance = $this->getBuilder()
->select(['nodes.id', 'nodes.memory', 'nodes.disk', 'nodes.memory_overallocate', 'nodes.disk_overallocate']) ->select(['nodes.id', 'nodes.memory', 'nodes.disk', 'nodes.memory_overallocate', 'nodes.disk_overallocate'])

View File

@ -291,7 +291,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
* @param int[] $servers * @param int[] $servers
* @param int[] $nodes * @param int[] $nodes
* @param bool $returnCount * @param bool $returnCount
* @return int|\Generator * @return int|\Illuminate\Support\LazyCollection
*/ */
public function getServersForPowerAction(array $servers = [], array $nodes = [], bool $returnCount = false) public function getServersForPowerAction(array $servers = [], array $nodes = [], bool $returnCount = false)
{ {