mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-30 16:30:45 +00:00
Add API StoryItemTransformer
This commit is contained in:
parent
fcabd961ce
commit
b752989fb6
1 changed files with 27 additions and 0 deletions
27
app/Transformer/Api/StoryItemTransformer.php
Normal file
27
app/Transformer/Api/StoryItemTransformer.php
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?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) Str::uuid(),
|
||||||
|
'type' => $item->type,
|
||||||
|
'length' => $item->duration,
|
||||||
|
'src' => $item->url(),
|
||||||
|
'preview' => null,
|
||||||
|
'link' => null,
|
||||||
|
'linkText' => null,
|
||||||
|
'time' => $item->updated_at->format('U'),
|
||||||
|
'seen' => $item->story->seen(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue