public function store()
{
if (Request::hasFile('cover_file') !== true) {
abort(422);
}
$forum = Forum::findOrFail(Request::input('forum_id'));
if ($forum->cover !== null) {
abort(422);
}
try {
$cover = ForumCover::upload(Request::file('cover_file')->getRealPath(), Auth::user(), $forum);
} catch (ImageProcessorException $e) {
return error_popup($e->getMessage());
}
return json_item($cover, new ForumCoverTransformer());
}