App\Transformers\Forum\TopicCoverTransformer::transform PHP Method

transform() public method

public transform ( TopicCover $cover = null )
$cover App\Models\Forum\TopicCover
    public function transform(TopicCover $cover = null)
    {
        if ($cover === null) {
            $cover = new TopicCover();
        }
        if ($cover->getFileProperties() === null) {
            $data = ['method' => 'post', 'url' => route('forum.topic-covers.store', ['topic_id' => $cover->topic_id])];
        } else {
            $data = ['method' => 'put', 'url' => route('forum.topic-covers.update', [$cover, 'topic_id' => $cover->topic_id]), 'id' => $cover->id, 'fileUrl' => $cover->fileUrl()];
        }
        $data['dimensions'] = $cover->getMaxDimensions();
        $data['defaultFileUrl'] = $cover->defaultFileUrl();
        return $data;
    }
TopicCoverTransformer