1. Go to this page and download the library: Download jobmetric/laravel-comment 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/ */
jobmetric / laravel-comment example snippets
use JobMetric\Comment\HasComment;
class Post extends Model
{
use HasComment;
}
use JobMetric\Comment\Contracts\CommentContract;
class Post extends Model implements CommentContract
{
use HasComment;
}
use JobMetric\Comment\Contracts\CommentContract;
class Post extends Model implements CommentContract
{
use HasComment;
public function needsCommentApproval(): bool
{
return false;
}
}
$post = Post::create([
'title' => 'Post title',
'body' => 'Post body',
]);
$post->comment('This is a comment', $parent_comment_id, $user_id);
$post->updateComment($comment->id, 'This is a new comment');
$post->forgetComment($comment->id);
$post->forgetComments();
$comments = $post->comments;
$comments = $post->approvedComments;
$comments = $post->unapprovedComments;
$comments = $post->parentComments;
use JobMetric\Comment\CanComment;
class User extends Authenticatable
{
use CanComment;
}
bash
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.