Add nests & eggs
Cleanup middleware handling and parameters on controllers...
This commit is contained in:
parent
de07b3cc7f
commit
8afced3410
26 changed files with 737 additions and 446 deletions
|
@ -34,8 +34,11 @@ class ServerManagementController extends ApplicationApiController
|
|||
* @param \Pterodactyl\Services\Servers\ReinstallServerService $reinstallServerService
|
||||
* @param \Pterodactyl\Services\Servers\SuspensionService $suspensionService
|
||||
*/
|
||||
public function __construct(ContainerRebuildService $rebuildService, ReinstallServerService $reinstallServerService, SuspensionService $suspensionService)
|
||||
{
|
||||
public function __construct(
|
||||
ContainerRebuildService $rebuildService,
|
||||
ReinstallServerService $reinstallServerService,
|
||||
SuspensionService $suspensionService
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->rebuildService = $rebuildService;
|
||||
|
@ -47,16 +50,15 @@ class ServerManagementController extends ApplicationApiController
|
|||
* Suspend a server on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function suspend(ServerWriteRequest $request, Server $server): Response
|
||||
public function suspend(ServerWriteRequest $request): Response
|
||||
{
|
||||
$this->suspensionService->toggle($server, SuspensionService::ACTION_SUSPEND);
|
||||
$this->suspensionService->toggle($request->getModel(Server::class), SuspensionService::ACTION_SUSPEND);
|
||||
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
|
@ -65,16 +67,15 @@ class ServerManagementController extends ApplicationApiController
|
|||
* Unsuspend a server on the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function unsuspend(ServerWriteRequest $request, Server $server): Response
|
||||
public function unsuspend(ServerWriteRequest $request): Response
|
||||
{
|
||||
$this->suspensionService->toggle($server, SuspensionService::ACTION_UNSUSPEND);
|
||||
$this->suspensionService->toggle($request->getModel(Server::class), SuspensionService::ACTION_UNSUSPEND);
|
||||
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
|
@ -83,16 +84,15 @@ class ServerManagementController extends ApplicationApiController
|
|||
* Mark a server as needing to be reinstalled.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\DisplayException
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function reinstall(ServerWriteRequest $request, Server $server): Response
|
||||
public function reinstall(ServerWriteRequest $request): Response
|
||||
{
|
||||
$this->reinstallServerService->reinstall($server);
|
||||
$this->reinstallServerService->reinstall($request->getModel(Server::class));
|
||||
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
|
@ -101,14 +101,13 @@ class ServerManagementController extends ApplicationApiController
|
|||
* Mark a server as needing its container rebuilt the next time it is started.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest $request
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
|
||||
*/
|
||||
public function rebuild(ServerWriteRequest $request, Server $server): Response
|
||||
public function rebuild(ServerWriteRequest $request): Response
|
||||
{
|
||||
$this->rebuildService->handle($server);
|
||||
$this->rebuildService->handle($request->getModel(Server::class));
|
||||
|
||||
return $this->returnNoContent();
|
||||
}
|
||||
|
|
Reference in a new issue