public function transform(ForumCover $cover = null) { if ($cover === null) { $cover = new ForumCover(); } if ($cover->id === null) { $data = ['method' => 'post', 'url' => route('forum.forum-covers.store', ['forum_id' => $cover->forum_id])]; } else { $data = ['method' => 'put', 'url' => route('forum.forum-covers.update', [$cover, 'forum_id' => $cover->forum_id]), 'id' => $cover->id, 'fileUrl' => $cover->fileUrl()]; } $data['dimensions'] = $cover->maxDimensions; return $data; }
public function update($id) { $cover = ForumCover::findOrFail($id); if (Request::hasFile('cover_file') === true) { try { $cover = $cover->updateFile(Request::file('cover_file')->getRealPath(), Auth::user()); } catch (ImageProcessorException $e) { return error_popup($e->getMessage()); } } return fractal_item_array($cover, new ForumCoverTransformer()); }
public function update($id) { $cover = ForumCover::findOrFail($id); $cover->update($this->coverParams()); return redirect(route('admin.forum.forum-covers.index') . '#forum-' . $cover->forum_id); }