2026-10-11 21:01:23 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Resources\Api\Client;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
use Pterodactyl\Models\User;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @extends ClientResource<User>
|
|
|
|
|
*/
|
|
|
|
|
class UserResource extends ClientResource
|
|
|
|
|
{
|
|
|
|
|
public function resourceName(): string
|
|
|
|
|
{
|
|
|
|
|
return User::RESOURCE_NAME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function toArray(Request $request): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'uuid' => $this->resource->uuid,
|
|
|
|
|
'identifier' => $this->resource->identifier,
|
|
|
|
|
'username' => $this->resource->username,
|
|
|
|
|
'email' => $this->resource->email,
|
2026-10-20 15:55:48 -04:00
|
|
|
'image' => $this->resource->avatar_url ?? 'https://gravatar.com/avatar/'.md5(Str::lower($this->resource->email)),
|
|
|
|
|
'avatar' => $this->resource->avatar_url,
|
2026-10-11 21:01:23 -04:00
|
|
|
'2fa_enabled' => $this->resource->use_totp,
|
|
|
|
|
'created_at' => $this->formatTimestamp($this->resource->created_at),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|