Replace egg repository
This commit is contained in:
parent
860b2d890b
commit
6e4f7f16c1
11 changed files with 54 additions and 206 deletions
|
@ -6,25 +6,18 @@ use Carbon\Carbon;
|
|||
use Pterodactyl\Models\Egg;
|
||||
use Illuminate\Support\Collection;
|
||||
use Pterodactyl\Models\EggVariable;
|
||||
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
|
||||
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
|
||||
|
||||
class EggExporterService
|
||||
{
|
||||
/**
|
||||
* EggExporterService constructor.
|
||||
*/
|
||||
public function __construct(protected EggRepositoryInterface $repository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a JSON representation of an egg and its variables.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
* @throws RecordNotFoundException
|
||||
*/
|
||||
public function handle(int $egg): string
|
||||
{
|
||||
$egg = $this->repository->getWithExportAttributes($egg);
|
||||
$egg = Egg::with(['scriptFrom', 'configFrom', 'variables'])->findOrFail($egg);
|
||||
|
||||
$struct = [
|
||||
'_comment' => 'DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue