1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00

Update AccountTransformer

This commit is contained in:
Daniel Supernault 2019-09-01 18:26:54 -06:00
parent 29e23d80cb
commit 34419ce2cc
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -2,11 +2,16 @@
namespace App\Transformer\Api;
use Auth;
use App\Profile;
use League\Fractal;
class AccountTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
'relationship',
];
public function transform(Profile $profile)
{
$is_admin = $profile->domain ? false : $profile->user->is_admin;
@ -32,7 +37,12 @@ class AccountTransformer extends Fractal\TransformerAbstract
'bot' => null,
'website' => $profile->website,
'software' => 'pixelfed',
'is_admin' => (bool) $is_admin
'is_admin' => (bool) $is_admin,
];
}
protected function includeRelationship(Profile $profile)
{
return $this->item($profile, new RelationshipTransformer());
}
}