1
0
Fork 0
pixelfed/app/Transformer/Api/AccountTransformer.php

39 lines
1.0 KiB
PHP
Raw Normal View History

2018-07-12 16:42:17 +00:00
<?php
namespace App\Transformer\Api;
use App\Profile;
use League\Fractal;
class AccountTransformer extends Fractal\TransformerAbstract
{
2018-12-31 04:26:37 +00:00
public function transform(Profile $profile)
{
$is_admin = $profile->domain ? false : $profile->user->is_admin;
2018-12-31 04:26:37 +00:00
return [
'id' => (string) $profile->id,
2018-12-31 04:26:37 +00:00
'username' => $profile->username,
'acct' => $profile->username,
'display_name' => $profile->name,
'locked' => (bool) $profile->is_private,
2019-06-05 07:18:09 +00:00
'created_at' => null,
2018-12-31 04:26:37 +00:00
'followers_count' => $profile->followerCount(),
'following_count' => $profile->followingCount(),
'statuses_count' => (int) $profile->statusCount(),
2018-12-31 04:26:37 +00:00
'note' => $profile->bio,
'url' => $profile->url(),
'avatar' => $profile->avatarUrl(),
'avatar_static' => $profile->avatarUrl(),
'header' => null,
'header_static' => null,
2019-05-05 00:14:59 +00:00
'header_bg' => $profile->header_bg,
2018-12-31 04:26:37 +00:00
'moved' => null,
'fields' => null,
'bot' => null,
2019-06-09 20:13:43 +00:00
'website' => $profile->website,
'software' => 'pixelfed',
'is_admin' => (bool) $is_admin
2018-12-31 04:26:37 +00:00
];
}
2018-08-28 03:07:36 +00:00
}