2018-02-24 20:09:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
|
|
|
|
|
2022-05-22 18:10:01 +00:00
|
|
|
use Pterodactyl\Models\Server;
|
2018-02-24 20:09:09 +00:00
|
|
|
use Pterodactyl\Transformers\Api\Application\ServerTransformer;
|
|
|
|
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
|
|
|
|
use Pterodactyl\Http\Requests\Api\Application\Servers\GetExternalServerRequest;
|
|
|
|
|
|
|
|
class ExternalServerController extends ApplicationApiController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Retrieve a specific server from the database using its external ID.
|
|
|
|
*/
|
2022-05-22 18:10:01 +00:00
|
|
|
public function index(GetExternalServerRequest $request, string $external_id): array
|
2018-02-24 20:09:09 +00:00
|
|
|
{
|
2022-05-22 18:10:01 +00:00
|
|
|
$server = Server::query()->where('external_id', $external_id)->firstOrFail();
|
|
|
|
|
|
|
|
return $this->fractal->item($server)
|
2018-02-24 20:09:09 +00:00
|
|
|
->transformWith($this->getTransformer(ServerTransformer::class))
|
|
|
|
->toArray();
|
|
|
|
}
|
|
|
|
}
|