"Like" and "Unlike" functions that add/remove one from column

I am making a forum using CakePHP 3, and I want a way for users to like and unlike (I know dislike is typically used, but unlike is more fitting since you can like and you can remove your like, but you can’t dislike or say that you specifically don’t like something).

I have an int column called “likes” in my database, and I want to make a function that will add one/remove one from that column.

I am able to change columns to a certain value already, here is my function for locking posts:


    public function lock($id = null)
        if ($this->Forumposts->lock($id)) {
			$this->Flash->success(__('The post has been locked.'));
            return $this->redirect(['action' => 'view', $id]);
        $this->Flash->error(__('An error occured.'));


    public function lock($id)
        $post = $this->get($id);
        $post->is_locked = 1;
        return $this->save($post);

However, I can’t figure out how to add one to the value of a column.

Any help would be greatly appreciated.

Anything wrong with $post->likes ++;?

That works great, thanks!