Fix up subuser API response for clients
This commit is contained in:
parent
51defae917
commit
5f13531c69
11 changed files with 86 additions and 41 deletions
|
@ -4,13 +4,14 @@ namespace Pterodactyl\Transformers\Api\Client;
|
|||
|
||||
use Pterodactyl\Models\Egg;
|
||||
use Pterodactyl\Models\Server;
|
||||
use Pterodactyl\Models\Subuser;
|
||||
|
||||
class ServerTransformer extends BaseClientTransformer
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $availableIncludes = ['egg'];
|
||||
protected $availableIncludes = ['egg', 'subusers'];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
|
@ -69,4 +70,16 @@ class ServerTransformer extends BaseClientTransformer
|
|||
{
|
||||
return $this->item($server->egg, $this->makeTransformer(EggTransformer::class), Egg::RESOURCE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the subusers associated with this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Collection
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeSubusers(Server $server)
|
||||
{
|
||||
return $this->collection($server->subusers, $this->makeTransformer(SubuserTransformer::class), Subuser::RESOURCE_NAME);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue