Add base routes for managing servers as a client

This commit is contained in:
Dane Everitt 2018-02-27 21:28:43 -06:00
parent 9a32b9fd03
commit cef3e4ced4
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
18 changed files with 262 additions and 270 deletions

View file

@ -0,0 +1,25 @@
<?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
* @return array
*/
public function index(GetServerRequest $request): array
{
return $this->fractal->item($request->getModel(Server::class))
->transformWith($this->getTransformer(ServerTransformer::class))
->toArray();
}
}