Download the PHP package yarmat/laravel-comment without Composer
On this page you can find all versions of the php package yarmat/laravel-comment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-comment
Laravel comments with Vue.js
Package for using comments with Vue.js component
Installing
composer require yarmat/laravel-comment
You must publish Vue Component, Languages, migration and config;
php artisan vendor:publish --provider="Yarmat\Comment\CommentServiceProvider"
After publishing you can create comments-tables by running the migrations:
php artisan migrate
Add middleware
Settings
You should edit config file
config/comment.php
Limit
Limit of comments when will you send a request for the route get (route('comment.get'))
Order
Models
Change the User Model
Prefix
Change prefix, if you need to change route prefix
{prefix}.store {prefix}.destroy {prefix}.update {prefix}.count {prefix}.get
Middleware
You can assign a middleware to each route:
Models that will implement comments
Relations
Add relations for you comments
or
Validation
TransformComment
Function that transform Comments Model before you get it in the Vue component
Allowable Tags
Php function strip_tags() that cuts out all tags except those that you list in the string
Spam Words
You can list spam words. Comments with these words will not be published.
Spam Sites
You can list allowable sites. The comment will not be published if there is an unresolved link in it.
Usage
F.e. you have model Post and you want to attach comments to it
Step 1
Add model to config
Step 2
Add Yarmat\Comment\Traits\HasCommentTrait and Yarmat\Comment\Contracts\CommentContract to your model Post:
Step 3
Add Yarmat\Comment\Traits\CommenterTrait to your User model
Step 4
Include comment component to your Vue App
Step 5
Include to your View
Step 6
Include config to your View
Finish
That is all! The you can customise vue component to your template. Component is here:
resources/js/components/comment
License
The Laravel-comment is open-sourced software licensed under the MIT license.