Downloads
Stars
Version
Tree comments system for laravel projects.
Add the next git repository definition into your composer.json file:
"repositories": [
...
{
"type": "vcs",
"url": "https://github.com/balaremember/laravel-comments-service"
}
...
]
Run composer install:
composer require balaremember/laravel-comments-service
ServiceProvider will be attached automatically
In your config/app.php
add Balaremember\LaravelCommentsService\CommentsServiceProvider::class
to the end of the providers
array:
'providers' => [
...
Balaremember\LaravelCommentsService\CommentsServiceProvider::class,
],
If Lumen
$app->register(Balaremember\LaravelCommentsService\CommentsServiceProvider::class);
Publish Configuration
php artisan vendor:publish --provider "Balaremember\LaravelCommentsService\CommentsServiceProvider"
Now you have comments config file with parameters:
'userModel' => Path to your user model, (default: App\User)
'perPage' => Number of comments on one page, (default: 10)
'levelDepth' => Depth of nesting. (default: 3)
Full description of the config variables
Custom Polymorphic Types in your AppServiceProvider like:
class YourModel extends Model
{
public function comments()
{
return $this->morphMany(Balaremember\LaravelCommentsService\Entities\Comment::class, 'commentable');
}
}
use Illuminate\Database\Eloquent\Relations\Relation;
Relation::morphMap([
'posts' => 'App\Post',
'videos' => 'App\Video',
]);
See more in Laravel Documentation