App\Http\Controllers\Forum\TopicCoversController::update PHP Method

update() public method

public update ( $id )
    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());
    }