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.
		
		
		
		
		
			
		
			
				
	
	
		
			35 lines
		
	
	
		
			850 B
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			35 lines
		
	
	
		
			850 B
		
	
	
	
		
			PHP
		
	
<?php
 | 
						|
 | 
						|
namespace App\Transformer\Api;
 | 
						|
 | 
						|
use App\Story;
 | 
						|
use League\Fractal;
 | 
						|
 | 
						|
class StoryTransformer extends Fractal\TransformerAbstract
 | 
						|
{
 | 
						|
    protected $defaultIncludes = [
 | 
						|
        'items',
 | 
						|
    ];
 | 
						|
 | 
						|
    public function transform(Story $story)
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            'id'                        => $story->id,
 | 
						|
            'photo'                     => $story->profile->avatarUrl(),
 | 
						|
            'name'                      => '',
 | 
						|
            'link'                      => '',
 | 
						|
            'lastUpdated'               => $story->updated_at->format('U'),
 | 
						|
            'seen'                      => $story->seen(),
 | 
						|
            'items'                     => [],
 | 
						|
        ];
 | 
						|
    }
 | 
						|
 | 
						|
    public function includeItems(Story $story)
 | 
						|
    {
 | 
						|
        $items = $story->items;
 | 
						|
 | 
						|
        return $this->collection($items, new StoryItemTransformer());
 | 
						|
    }
 | 
						|
 | 
						|
}
 |