PHP code example of cjmellor / engageify

1. Go to this page and download the library: Download cjmellor/engageify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cjmellor / engageify example snippets




use Cjmellor\Engageify\Concerns\HasEngagements;

class BlogPost extends Model
{
    use HasEngagements;

    // ...
}

// Like
$post->like();

// Dislike
$post->dislike();

// Upvote
$post->upvote();

// Downvote
$post->downvote();

$comment->unlike();

$comment->toggleLike();

// Likes
$post->likes();

// Dislikes
$post->dislikes();

// Upvotes
$post->upvotes();

// Downvotes
$post->downvotes();

$post->likes(showUsers: true);

public Model $user,
public Model $engageable,
public Engagement $engagement,

public Model $user,
public Model $engageable,
bash
php artisan vendor:publish --tag="engageify-config"
text
ENGAGEIFY_ALLOW_CACHING=true
ENGAGEIFY_CACHE_DURATION=3600