mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update AccountTransformer
This commit is contained in:
parent
29e23d80cb
commit
34419ce2cc
1 changed files with 11 additions and 1 deletions
|
@ -2,11 +2,16 @@
|
||||||
|
|
||||||
namespace App\Transformer\Api;
|
namespace App\Transformer\Api;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
|
|
||||||
class AccountTransformer extends Fractal\TransformerAbstract
|
class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
{
|
{
|
||||||
|
protected $defaultIncludes = [
|
||||||
|
'relationship',
|
||||||
|
];
|
||||||
|
|
||||||
public function transform(Profile $profile)
|
public function transform(Profile $profile)
|
||||||
{
|
{
|
||||||
$is_admin = $profile->domain ? false : $profile->user->is_admin;
|
$is_admin = $profile->domain ? false : $profile->user->is_admin;
|
||||||
|
@ -32,7 +37,12 @@ class AccountTransformer extends Fractal\TransformerAbstract
|
||||||
'bot' => null,
|
'bot' => null,
|
||||||
'website' => $profile->website,
|
'website' => $profile->website,
|
||||||
'software' => 'pixelfed',
|
'software' => 'pixelfed',
|
||||||
'is_admin' => (bool) $is_admin
|
'is_admin' => (bool) $is_admin,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function includeRelationship(Profile $profile)
|
||||||
|
{
|
||||||
|
return $this->item($profile, new RelationshipTransformer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue