Skip to content

aschelch/cakephp-like-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cakephp-like-plugin

CakePHP Like Plugin

Installation

Download the plugin

 git submodule add git://github.com/aschelch/cakephp-like-plugin.git app/Plugin/Like

Create the like table using

cake Like.install

Attach the Likeable behavior to the model

public Post extends AppModel{
	$actsAs = array('Like.Likeable');
}

In your controller, you can use functions :

$this->Post->like($post_id, $this->Auth->user('id'));

$this->Post->dislike($post_id, $this->Auth->user('id'));

$this->Post->findLikedBy($this->Auth->user('id'));

if($this->Post->isLikedBy($post_id, $this->Auth->user('id'))){...}

$this->Post->find('most_liked', array('limit'=>5));

Or use the Like controller and Like helper

public PostController extends AppController{
	public $helpers = array('Like.Like');
}

In your view:

$this->Like->like('post', $post_id);
$this->Like->dislike('post', $post_id);

About

CakePHP Like Plugin provide a feature similar to Facebook "Like".

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages