25 lines
898 B
PHP
25 lines
898 B
PHP
<?php
|
|
|
|
namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
|
|
|
|
use Pterodactyl\Models\Server;
|
|
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.
|
|
*
|
|
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
|
*/
|
|
public function index(GetExternalServerRequest $request, string $external_id): array
|
|
{
|
|
$server = Server::query()->where('external_id', $external_id)->firstOrFail();
|
|
|
|
return $this->fractal->item($server)
|
|
->transformWith($this->getTransformer(ServerTransformer::class))
|
|
->toArray();
|
|
}
|
|
}
|