Announce.php 675 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Transformer\ActivityPub\Verb;
  3. use App\Status;
  4. use League\Fractal;
  5. class Announce extends Fractal\TransformerAbstract
  6. {
  7. public function transform(Status $status)
  8. {
  9. return [
  10. '@context' => 'https://www.w3.org/ns/activitystreams',
  11. 'id' => $status->permalink(),
  12. 'type' => 'Announce',
  13. 'actor' => $status->profile->permalink(),
  14. 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
  15. 'cc' => [
  16. $status->profile->permalink(),
  17. $status->profile->follower_url ?? $status->profile->permalink('/followers')
  18. ],
  19. 'published' => $status->created_at->format(DATE_ISO8601),
  20. 'object' => $status->parent()->url(),
  21. ];
  22. }
  23. }