1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00
pixelfed/app/Transformer/Api/RelationshipTransformer.php

29 lines
874 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)
{
2019-06-10 02:36:08 +00:00
$auth = Auth::check();
$user = $auth ? Auth::user()->profile : false;
2018-11-19 04:53:05 +00:00
return [
'id' => (string) $profile->id,
2019-06-10 02:36:08 +00:00
'following' => $auth ? $user->follows($profile) : false,
'followed_by' => $auth ? $user->followedBy($profile) : false,
'blocking' => $auth ? $user->blockedIds()->contains($profile->id) : false,
'muting' => $auth ? $user->mutedIds()->contains($profile->id) : false,
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
];
}
}