1. Go to this page and download the library: Download manzadey/laravel-like 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/ */
manzadey / laravel-like example snippets
use Manzadey\LaravelLike\Traits\Likeability;
use Manzadey\LaravelLike\Contracts\LikeabilityContract;
class User extends Authenticatable implements LikeabilityContract;
{
use Likeability;
}
use Manzadey\LaravelLike\Traits\Likeable;
use Manzadey\LaravelLike\Contracts\LikeableContract;
class Post extends Model implements LikeableContract
{
use Likeable;
}
$article = \App\Models\Article::first();
$user = \App\Models\User::first();
$article->like($user); // Add the current model to like of the specified user
$article->dislike($user); // Add the current model to dislike of the specified user
$article->toggleLike($user); // The switch of the likes of the specified user
$article->removeLikeable($user); // Delete the current module from the likes of the specified user
$article->isLike($user); // Check the current model whether it is a likes of the specified user
$article->isDislike($user); // Check the current model whether it is a likes of the specified user