mirror of https://github.com/pixelfed/pixelfed
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			28 lines
		
	
	
		
			788 B
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			28 lines
		
	
	
		
			788 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) 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(),
 | 
						|
        ];
 | 
						|
    }
 | 
						|
 | 
						|
}
 |