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

28 lines
763 B
PHP
Raw Normal View History

2018-11-19 04:53:05 +00:00
<?php
namespace App\Transformer\Api;
use Auth;
2018-11-19 04:53:05 +00:00
use App\Profile;
use League\Fractal;
class RelationshipTransformer extends Fractal\TransformerAbstract
{
public function transform(Profile $profile)
{
$user = Auth::user()->profile;
2018-11-19 04:53:05 +00:00
return [
'id' => (string) $profile->id,
'following' => $user->follows($profile),
'followed_by' => $user->followedBy($profile),
2019-04-08 02:35:56 +00:00
'blocking' => $user->blockedIds()->contains($profile->id),
'muting' => $user->mutedIds()->contains($profile->id),
2018-11-19 04:53:05 +00:00
'muting_notifications' => null,
'requested' => null,
'domain_blocking' => null,
'showing_reblogs' => null,
'endorsed' => false
2018-11-19 04:53:05 +00:00
];
}
}