mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 11:55:51 -05:00
35 lines
960 B
PHP
35 lines
960 B
PHP
<?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,
|
|
'image' => $this->resource->avatar_url ?? 'https://gravatar.com/avatar/'.md5(Str::lower($this->resource->email)),
|
|
'avatar' => $this->resource->avatar_url,
|
|
'2fa_enabled' => $this->resource->use_totp,
|
|
'created_at' => $this->formatTimestamp($this->resource->created_at),
|
|
];
|
|
}
|
|
}
|