mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 05:14:46 +02:00

* Not found property rule * Make these “better” * Day 1 * Day 2 * Day 3 * Dat 4 * Remove disabled check * Day 4 continued * Run pint * Final changes hopefully * Pint fixes * Fix again * Reset these * Update app/Filament/Admin/Pages/Health.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> * Update app/Traits/CheckMigrationsTrait.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> --------- Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Transformers\Api\Client;
|
|
|
|
use Illuminate\Support\Str;
|
|
use App\Models\User;
|
|
|
|
class UserTransformer extends BaseClientTransformer
|
|
{
|
|
/**
|
|
* Return the resource name for the JSONAPI output.
|
|
*/
|
|
public function getResourceName(): string
|
|
{
|
|
return User::RESOURCE_NAME;
|
|
}
|
|
|
|
/**
|
|
* @param User $user
|
|
*
|
|
* {@inheritdoc}
|
|
*/
|
|
public function transform($user): array
|
|
{
|
|
return [
|
|
'uuid' => $user->uuid,
|
|
'username' => $user->username,
|
|
'email' => $user->email,
|
|
'language' => $user->language,
|
|
'image' => 'https://gravatar.com/avatar/' . md5(Str::lower($user->email)), // deprecated
|
|
'admin' => $user->isRootAdmin(), // deprecated, use "root_admin"
|
|
'root_admin' => $user->isRootAdmin(),
|
|
'2fa_enabled' => (bool) $user->use_totp,
|
|
'created_at' => $this->formatTimestamp($user->created_at),
|
|
'updated_at' => $this->formatTimestamp($user->updated_at),
|
|
];
|
|
}
|
|
}
|