public function transform(ForumCover $cover = null) { if ($cover === null) { $cover = new ForumCover(); } if ($cover->getFileProperties() === null) { $data = ['method' => 'post', 'url' => route('forum.forum-covers.store', ['forum_id' => $cover->forum_id])]; } else { $data = ['method' => 'patch', 'url' => route('forum.forum-covers.update', [$cover, 'forum_id' => $cover->forum_id]), 'id' => $cover->id, 'fileUrl' => $cover->fileUrl()]; } $data['dimensions'] = $cover->getMaxDimensions(); return $data; }