1. Go to this page and download the library: Download editmode/laravel-comments 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/ */
editmode / laravel-comments example snippets
use Nika\LaravelComments\Models\Comment as BaseComment;
class Comment extends BaseComment
↑
{
// Add your own relationships, scopes, or overrides here
}
return [
'model' => App\Models\Comment::class,
];
use Nika\LaravelComments\Traits\HasComments;
class Post extends Model
{
use HasComments;
}
$post = Post::find(1);
$post->comment('This is a comment from the logged-in user');
$post->commentAsUser($user, 'This is a comment from a specific user');
use Nika\LaravelComments\Models\Comment as BaseComment;
use Nika\LaravelComments\Traits\HasReactions;
class Comment extends BaseComment
{
use HasReactions;
}