1. Go to this page and download the library: Download panoscape/remarks 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/ */
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Panoscape\Remarks\HasRemarks;
class User extends Authenticatable
{
use Notifiable, SoftDeletes, HasRemarks;
}
namespace App;
use Illuminate\Database\Eloquent\Model;
use Panoscape\Remarks\Remarkable;
class Article extends Model
{
use Remarkable;
}
//get all remarks
$user->remakrs();
//or dynamic property
$user->remarks;
//get all likes
$user->likes();
//get all dislikes
$user->dislikes();
//get all remarks
$remarkable->remarks();
//or dynamic property
$remarkable->remarks;
//get all likes
$remarkable->likes();
//get all dislikes
$remarkable->dislikes();
//check if a remarkable is liked by current user
$remarkable->liked();
//or dynamic property
$remarkable->liked;
//check if a remarkable is liked by a specific user
$remarkable->liked($user);
//same with dislike and remark
$remarkable->disliked();
$remarkable->disliked($user);
$remarkable->remarked($user);
$remarkable->remarked();
//check if a user likes a specific remarkable
$user->liked($remarkable);
//check if a user dislikes a specific remarkable
$user->disliked($remarkable);
//check if a user dislikes/likes a specific remarkable
$user->remarked($remarkable);
//count
$remarkable->likesCount;
$remarkable->dislikesCount;
$remarkable->remarksCount;
$user->likesCount;
$user->dislikesCount;
$user->remarksCount;
//add a like for model by current user
$remarkable->like();
//add a like for model by the given user
$remarkable->like($user);
//remove a like from this record for current user
$remarkable->unlike();
//remove a like from this record for the given user
$remarkable->unlike($user);
//clear likes
$remarkable->clearLikes();
//same with dislike
$remarkable->dislike();
$remarkable->dislike($user);
$remarkable->undislike();
$remarkable->undislike($user);
$remarkable->clearDislikes();
$remarkable->clearRemarks();
//on user
$user->like($remarkable);
$user->unlike($remarkable);
$user->dislike($remarkable);
$user->undislike($remarkable);
$user->clearLikes();
$user->clearDislikes();
$user->clearRemarks();
//toggle
$remarkable->toggleLike();
$remarkable->toggleLike($user);
$remarkable->toggleDislike();
$remarkable->toggleDislike($user);
$user->toggleLike($remarkable);
$user->toggleDislike($remarkable);
//get the remarkable model
$remark->model();
//or dynamic property
$remark->model;
//get the user
$remark->user();
//or dynamic property
$remark->user;