devianl2/laravel-comment is a Laravel package for laravel comment and rateable package.
It currently has 0 GitHub stars and 12 downloads on Packagist (latest version 1.0.6).
Install it with composer require devianl2/laravel-comment.
Discover more Laravel packages by devianl2
or browse all Laravel packages to compare alternatives.
Last updated
This Laravel package provides a robust solution for managing comments and ratings in your Laravel application. It allows you to easily perform the following actions:
You can install the package via Composer by running the following command:
composer require devianl2/laravel-comment
To use this package, you need to follow these steps:
php artisan vendor:publish --provider="Devianl2\CommentRateable\CommentRateableServiceProvider" --tag="migrations"
php artisan migrate
CommentRateable trait to your Post model.
use Devianl2\CommentRateable\Traits\CommentRateable;
class Post extends Model
{
use CommentRateable;
}
$post = Post::first();
$comment = $post->comment([
'title' => 'This is a test title',
'body' => 'And we will add some shit here',
'rating' => 5,
'is_approved' => true, // This is optional and defaults to false
], $user);
$post = Post::first();
$comment = $post->updateComment(
$commentId,
[
'title' => 'This is a test title',
'body' => 'And we will add some shit here',
'rating' => 5,
'is_approved' => true, // This is optional and defaults to false
], $user);
$post = Post::first();
$post->averageRating();
$post->getComments();
$post->getComments(true);
$post->getComments(true, true);
$post->getComments(true, false, 0);
$comment->delete();
Contributions to this package are always welcome. If you find any issues or want to add new features, please create an issue or submit a pull request on the GitHub repository of this package.
This package is open-source software licensed under the MIT license .