Remove all references of packs from the Panel

This commit is contained in:
Dane Everitt 2020-09-13 11:13:37 -07:00
parent f1978683cc
commit 3c7ffaaadb
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
60 changed files with 129 additions and 2517 deletions

View file

@ -26,7 +26,7 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa
}
/**
* Return a nest or all nests with their associated eggs, variables, and packs.
* Return a nest or all nests with their associated eggs and variables.
*
* @param int $id
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
@ -35,7 +35,7 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa
*/
public function getWithEggs(int $id = null)
{
$instance = $this->getBuilder()->with('eggs.packs', 'eggs.variables');
$instance = $this->getBuilder()->with('eggs', 'eggs.variables');
if (! is_null($id)) {
$instance = $instance->find($id, $this->getColumns());
@ -50,7 +50,7 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa
}
/**
* Return a nest or all nests and the count of eggs, packs, and servers for that nest.
* Return a nest or all nests and the count of eggs and servers for that nest.
*
* @param int|null $id
* @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection
@ -59,7 +59,7 @@ class NestRepository extends EloquentRepository implements NestRepositoryInterfa
*/
public function getWithCounts(int $id = null)
{
$instance = $this->getBuilder()->withCount(['eggs', 'packs', 'servers']);
$instance = $this->getBuilder()->withCount(['eggs', 'servers']);
if (! is_null($id)) {
$instance = $instance->find($id, $this->getColumns());

View file

@ -1,52 +0,0 @@
<?php
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\Pack;
use Pterodactyl\Repositories\Concerns\Searchable;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\PackRepositoryInterface;
class PackRepository extends EloquentRepository implements PackRepositoryInterface
{
use Searchable;
/**
* Return the model backing this repository.
*
* @return string
*/
public function model()
{
return Pack::class;
}
/**
* Return a pack with the associated server models attached to it.
*
* @param \Pterodactyl\Models\Pack $pack
* @param bool $refresh
* @return \Pterodactyl\Models\Pack
*/
public function loadServerData(Pack $pack, bool $refresh = false): Pack
{
if ($refresh) {
$pack->load(['servers.node', 'servers.user']);
}
$pack->loadMissing(['servers.node', 'servers.user']);
return $pack;
}
/**
* Return a paginated listing of packs with their associated egg and server count.
*
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
public function paginateWithEggAndServerCount(): LengthAwarePaginator
{
return $this->getBuilder()->with('egg')->withCount('servers')
->paginate(50, $this->getColumns());
}
}

View file

@ -63,7 +63,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*/
public function getDataForRebuild(int $server = null, int $node = null): Collection
{
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'pack', 'egg', 'node']);
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']);
if (! is_null($server) && is_null($node)) {
$instance = $instance->where('id', '=', $server);
@ -83,7 +83,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*/
public function getDataForReinstall(int $server = null, int $node = null): Collection
{
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'pack', 'egg', 'node']);
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'egg', 'node']);
if (! is_null($server) && is_null($node)) {
$instance = $instance->where('id', '=', $server);
@ -140,7 +140,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
*/
public function getDataForCreation(Server $server, bool $refresh = false): Server
{
foreach (['allocation', 'allocations', 'pack', 'egg'] as $relation) {
foreach (['allocation', 'allocations', 'egg'] as $relation) {
if (! $server->relationLoaded($relation) || $refresh) {
$server->load($relation);
}
@ -167,7 +167,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
/**
* Get data for use when updating a server on the Daemon. Returns an array of
* the egg and pack UUID which are used for build and rebuild. Only loads relations
* the egg which is used for build and rebuild. Only loads relations
* if they are missing, or refresh is set to true.
*
* @param \Pterodactyl\Models\Server $server
@ -180,13 +180,8 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
$server->load('egg');
}
if (! $server->relationLoaded('pack') || $refresh) {
$server->load('pack');
}
return [
'egg' => $server->getRelation('egg')->uuid,
'pack' => is_null($server->getRelation('pack')) ? null : $server->getRelation('pack')->uuid,
];
}