Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wimil/comments
Super comment system for laravel
https://github.com/wimil/comments
backlist comments laravel moderation package php system
Last synced: about 2 months ago
JSON representation
Super comment system for laravel
- Host: GitHub
- URL: https://github.com/wimil/comments
- Owner: wimil
- License: mit
- Created: 2019-09-19T22:38:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-25T23:46:58.000Z (over 5 years ago)
- Last Synced: 2024-04-25T12:20:21.298Z (9 months ago)
- Topics: backlist, comments, laravel, moderation, package, php, system
- Language: PHP
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Comments for Laravel.
## Features
- Comments and reply Comments
- Blacklist
- Moderation Mode
- Mode => 1 (Public): All comments will be public.
- Mode => 2 (Review comments on the blacklist): Comments that do not contain blacklisted words will be public. Otherwise, they will remain hidden
- Mode => 3 (Close): Comments will be created that do not contain blacklisted words. Otherwise, they will not be created
- Limit comment characters
- Limit number of links in a comment
- UrlLinker (convert text links to html)## Installation
From the command line:
```bash
composer require wimil/comments
```### Publish Config & configure
Publish the config file:
```bash
php artisan vendor:publish --provider="Wimil\Comments\Provider" --tag=config
```### Publish Migrations
You can publish migration to allow you to have more control over your table
```bash
php artisan vendor:publish --provider="Wimil\Comments\Provider" --tag=migrations
```### Run migrations
We need to create the table for comments.
```bash
php artisan migrate
```### Add Commenter trait to your Model
Add the `Commenter` trait to your User model so that you can retrieve the comments for a user:
```php
use Wimil\Comments\Commenter;class User extends Authenticatable
{
use Notifiable, Commenter;
}
```### Add Commentable trait to models
Add the `Commentable` trait to the model for which you want to enable comments for:
```php
use Wimil\Comments\Commentable;class Product extends Model
{
use Commentable;
}
```If you want to have your own Comment Model create a new one and extend my Comment model.
``` php
use Wimil\Comments\Model\Comment as BaseComment;class Comment extends BaseComment
{
// ...
}
```and dont forget to update the model name in the `config/comment.php` file.
Comment package comes with several modes.
## Usage
``` php
$user = App\User::first();
$product = App\Product::first();// $user->comment(Commentable $model, $comment = '');
$user->comment($product, 'Lorem ipsum ..');```