Remove all references of packs from the Panel
This commit is contained in:
parent
f1978683cc
commit
3c7ffaaadb
60 changed files with 129 additions and 2517 deletions
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
|
@ -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,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue