laravel_comments_system
laravel comments system is a laravel package .in frontend template use vue js that provides user interfaces inviroment. .
Requiments
-
PHP >= 7.0
-
Laravel 5.5|5.6
Installation
Quick installation
composer require artincms/laravel_comment_system
publish vendor
$ php artisan vendor:publish --provider=ArtinCMS\LCS\LCSServiceProvider
if update package for publish vendor you should run :
$ php artisan vendor:publish --provider=ArtinCMS\LCS\LCSServiceProvider --force
migrate tabales
publish seed
```apple js
php artisan db:seed --class="ArtinCMS\LCS\Database\Seeds\LmmMorphableTableSeeder"
```
in all category you want use laravel comment system you should fill lmm_morphable table .
forexample if you want use this package for article you should fill lmm_morphable as bellow :
pck_name |
dev_name |
name |
model_name |
target_column_name |
target_column_alias |
generate_url_func |
article |
article_model |
مقالات |
App\Article |
title |
عنوان |
comment_url |
usage
for use this package you should use bellow helper function anywhere in your project such as in your controller .
this helper function is :
create html modal for show Comment manager in backed
LCS_createBackendCommentHtml()
use Comment Template in frontend
laravel comment system use vue.js for show template in frontend .
for use comment Template in your page (for example your article page) you shold insert bellow component in anywhere you want .
<div id="lcs_comment">
<laravel_comment_system target_model_name="item_model" target_id="{{LCS_getEncodeId(1)}}" target_parent_column_name="encode_parent_id" :rtl=true :jalali_data=true></laravel_comment_system>
</div>
that target model is model you want to connect to comment and id is database id of element and 'target_parent_column_nam' is name of parrent in database .
Config Parameter
this package has a config file in config/laravel_comment_system.php
that provide information for package . in continue we review some parameter
in the package :
auto_publish
if auto_publish is true every comment show in frontend and if false just
approved comment show
guest_can_comments
if you want just loggin user can comment set this parameters true .
show_comment_item
in laravel comment system backend you can define opinion poll for each item
for show this opinion poll for items you should set this parameters to true .
user_data
for get user data you should define helper and set helper name in this config
in bellow we suggest example of helper :
```apple js
function LCS_GetUserInformation($user_id)
{
$user = \Illuminate\Foundation\Auth\User::find($user_id);
return [
'name' => $user->username,
'email' => $user->email,
] ;
}
```