Path: blob/1.0-develop/app/Http/Controllers/Api/Application/Servers/StartupController.php
10277 views
<?php12namespace Pterodactyl\Http\Controllers\Api\Application\Servers;34use Pterodactyl\Models\User;5use Pterodactyl\Models\Server;6use Pterodactyl\Services\Servers\StartupModificationService;7use Pterodactyl\Transformers\Api\Application\ServerTransformer;8use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;9use Pterodactyl\Http\Requests\Api\Application\Servers\UpdateServerStartupRequest;1011class StartupController extends ApplicationApiController12{13/**14* StartupController constructor.15*/16public function __construct(private StartupModificationService $modificationService)17{18parent::__construct();19}2021/**22* Update the startup and environment settings for a specific server.23*24* @throws \Illuminate\Validation\ValidationException25* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException26* @throws \Pterodactyl\Exceptions\Model\DataValidationException27* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException28*/29public function index(UpdateServerStartupRequest $request, Server $server): array30{31$server = $this->modificationService32->setUserLevel(User::USER_LEVEL_ADMIN)33->handle($server, $request->validated());3435return $this->fractal->item($server)36->transformWith($this->getTransformer(ServerTransformer::class))37->toArray();38}39}404142