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

update() public method

public update ( $id )
    public function update($id)
    {
        $post = Post::findOrFail($id);
        priv_check('ForumPostEdit', $post)->ensureCan();
        $body = Request::input('body');
        if ($body !== '') {
            $post->edit($body, Auth::user());
        }
        $posts = collect([$post->fresh()]);
        $topic = $post->topic;
        $postsPosition = $topic->postsPosition($posts);
        return view('forum.topics._posts', compact('posts', 'postsPosition', 'topic'));
    }