mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-23 15:01:27 +00:00
28 lines
902 B
PHP
28 lines
902 B
PHP
<?php
|
|
|
|
namespace App\Transformer\Api;
|
|
|
|
use App\StoryItem;
|
|
use League\Fractal;
|
|
use Illuminate\Support\Str;
|
|
|
|
class StoryItemTransformer extends Fractal\TransformerAbstract
|
|
{
|
|
|
|
public function transform(StoryItem $item)
|
|
{
|
|
return [
|
|
'id' => (string) $item->id,
|
|
'type' => $item->type,
|
|
'length' => $item->duration != 0 ? $item->duration : 3,
|
|
'src' => $item->url(),
|
|
'preview' => null,
|
|
'link' => null,
|
|
'linkText' => null,
|
|
'time' => $item->created_at->format('U'),
|
|
'expires_at' => $item->created_at->addHours(24)->format('U'),
|
|
'seen' => $item->story->seen(),
|
|
];
|
|
}
|
|
|
|
}
|