2021-07-28 04:23:11 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Transformers\Api\Client;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\PersonalAccessToken;
|
|
|
|
|
|
|
|
class PersonalAccessTokenTransformer extends BaseClientTransformer
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getResourceName(): string
|
|
|
|
{
|
|
|
|
return PersonalAccessToken::RESOURCE_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \Pterodactyl\Models\PersonalAccessToken $model
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function transform(PersonalAccessToken $model): array
|
|
|
|
{
|
|
|
|
return [
|
2021-07-29 03:53:54 +00:00
|
|
|
'token_id' => $model->token_id,
|
|
|
|
'description' => $model->description,
|
2021-07-28 04:23:11 +00:00
|
|
|
'abilities' => $model->abilities ?? [],
|
|
|
|
'last_used_at' => $model->last_used_at ? $model->last_used_at->toIso8601String() : null,
|
|
|
|
'created_at' => $model->created_at->toIso8601String(),
|
|
|
|
'updated_at' => $model->updated_at->toIso8601String(),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|