AcceptFollow.php 640 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Transformer\ActivityPub\Verb;
  3. use App\FollowRequest;
  4. use League\Fractal;
  5. class AcceptFollow extends Fractal\TransformerAbstract
  6. {
  7. public function transform(FollowRequest $follow)
  8. {
  9. return [
  10. '@context' => 'https://www.w3.org/ns/activitystreams',
  11. 'type' => 'Accept',
  12. 'id' => $follow->permalink(),
  13. 'actor' => $follow->target->permalink(),
  14. 'object' => [
  15. 'type' => 'Follow',
  16. 'id' => $follow->activity && isset($follow->activity['id']) ? $follow->activity['id'] : null,
  17. 'actor' => $follow->actor->permalink(),
  18. 'object' => $follow->target->permalink()
  19. ]
  20. ];
  21. }
  22. }