Use a standardized transformer base; replace all client transformers to call that base
This commit is contained in:
parent
2203a4d87e
commit
cf500a1a54
25 changed files with 255 additions and 379 deletions
|
@ -3,28 +3,19 @@
|
|||
namespace Pterodactyl\Transformers\Api\Client;
|
||||
|
||||
use Pterodactyl\Models\Subuser;
|
||||
use Pterodactyl\Transformers\Api\Transformer;
|
||||
|
||||
class SubuserTransformer extends BaseClientTransformer
|
||||
class SubuserTransformer extends Transformer
|
||||
{
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
return Subuser::RESOURCE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a subuser into a model that can be shown to a front-end user.
|
||||
*
|
||||
* @return array|void
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function transform(Subuser $model)
|
||||
public function transform(Subuser $model): array
|
||||
{
|
||||
return array_merge(
|
||||
$this->makeTransformer(UserTransformer::class)->transform($model->user),
|
||||
(new UserTransformer())->transform($model->user),
|
||||
['permissions' => $model->permissions]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue