public function transform(TopicCover $cover = null) { if ($cover === null) { $cover = new TopicCover(); } if ($cover->id === 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(); return $data; }