public function update($id) { $cover = TopicCover::findOrFail($id); priv_check('ForumTopicCoverEdit', $cover)->ensureCan(); 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 json_item($cover, new TopicCoverTransformer()); }
public function update($id) { $cover = TopicCover::findOrFail($id); if ($cover->canBeEditedBy(Auth::user()) === false) { abort(403); } 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 TopicCoverTransformer()); }