2018-02-28 03:28:43 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
use Pterodactyl\Transformers\Api\Client\ServerTransformer;
|
|
|
|
use Pterodactyl\Http\Controllers\Api\Client\ClientApiController;
|
|
|
|
use Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest;
|
|
|
|
|
|
|
|
class ServerController extends ClientApiController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform an individual server into a response that can be consumed by a
|
|
|
|
* client using the API.
|
|
|
|
*
|
|
|
|
* @param \Pterodactyl\Http\Requests\Api\Client\Servers\GetServerRequest $request
|
2019-09-06 04:41:20 +00:00
|
|
|
* @param \Pterodactyl\Models\Server $server
|
2018-02-28 03:28:43 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
2019-09-06 04:41:20 +00:00
|
|
|
public function index(GetServerRequest $request, Server $server): array
|
2018-02-28 03:28:43 +00:00
|
|
|
{
|
2019-09-06 04:41:20 +00:00
|
|
|
return $this->fractal->item($server)
|
2018-02-28 03:28:43 +00:00
|
|
|
->transformWith($this->getTransformer(ServerTransformer::class))
|
|
|
|
->toArray();
|
|
|
|
}
|
|
|
|
}
|