1. Go to this page and download the library: Download sohrab-az/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/ */
sohrab-az / laravel-comment example snippets
return [
'default_status' => \SohrabAzinfar\Comment\Enums\CommentStatusEnum::Pending->value,
// Maximum depth of nested replies
'depth' => 5,
];
use SohrabAzinfar\Comment\Traits\HasComments;
class Post extends Model
{
use HasComments;
}
$post->addComment(
body: 'This is a comment',
author: auth()->user()
);