2018-11-13 06:15:08 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Transformer\ActivityPub\Verb;
|
|
|
|
|
|
|
|
use App\Status;
|
|
|
|
use League\Fractal;
|
|
|
|
|
|
|
|
class Announce extends Fractal\TransformerAbstract
|
|
|
|
{
|
|
|
|
public function transform(Status $status)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
2019-06-24 20:36:41 +00:00
|
|
|
'id' => $status->permalink(),
|
2018-11-13 06:15:08 +00:00
|
|
|
'type' => 'Announce',
|
|
|
|
'actor' => $status->profile->permalink(),
|
2019-06-24 20:36:41 +00:00
|
|
|
'to' => ['https://www.w3.org/ns/activitystreams#Public'],
|
|
|
|
'cc' => [
|
2019-06-25 04:21:54 +00:00
|
|
|
$status->profile->permalink(),
|
|
|
|
$status->profile->follower_url ?? $status->profile->permalink('/followers')
|
2019-06-24 20:36:41 +00:00
|
|
|
],
|
|
|
|
'published' => $status->created_at->format(DATE_ISO8601),
|
|
|
|
'object' => $status->parent()->url(),
|
2018-11-13 06:15:08 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|