composer require risul/laravel-like-comment
risul\LaravelLikeComment\LikeCommentServiceProvider::class
@include('laravelLikeComment::like', ['like_item_id' => 'image_31'])
Teach you how to use laravel-like-comment comment plug-in
The following tutorial column will introduce you to the use of laravel-like-comment comment plug-in, I hope it will be helpful to friends in need!
Laravel like comment
laravel-like-comment is an ajax-based Laravel comment system. Users need to log in to comment Comment and like the articles or other modules you like.
Function
Like
Dislike- Comment
- Support for comment information
- User avatar
- ##Installation
composer require risul/laravel-like-comment
Copy after login
Configuration ServiceAdd composer require risul/laravel-like-comment
risul\LaravelLikeComment\LikeCommentServiceProvider::class
Copy after login to your service providerr
list, and publish the configuration servicerisul\LaravelLikeComment\LikeCommentServiceProvider::class
php artisan vendor:publish
Migrate the data table Create data tables related to comments.
php artisan migrate
<link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/components/icon.min.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/components/comment.min.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/components/form.min.css" rel="stylesheet"> <link href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/components/button.min.css" rel="stylesheet"> <link href="{{ asset('/vendor/laravelLikeComment/css/style.css') }}" rel="stylesheet">
Note : Because jquery in the original article uses Google resources, I modified it to domestic.
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script> <script src="{{ asset('/vendor/laravelLikeComment/js/script.js') }}" type="text/javascript"></script>
config/laravelLikeComment.php
Note: Be optimistic about your user model path and whether to modify it. The default path is below.
'userModel' => 'App\User'
Use on the page you want to add likes to Add the following code./** * Return the user attributes. * @return array */ public static function getAuthor($id) { $user = self::find($id); return [ 'id' => $user->id, 'name' => $user->name, 'email' => $user->email, 'url' => '', // Optional 'avatar' => 'gravatar', // Default avatar 'admin' => $user->role === 'admin', // bool ]; }Copy after login
@include('laravelLikeComment::like', ['like_item_id' => 'image_31'])
Copy after loginlike_item_id:
is the tag id of the module to be integrated.@include('laravelLikeComment::like', ['like_item_id' => 'image_31'])
For example, I want to display the article in the article post model Add this function to the page and mark it in the data table. The detailed information of this data can be combined and marked post_1 (post is the article model, 1 is the article id). The quote is as follows:
@include('laravelLikeComment::like', ['like_item_id' => "post_".$post->id])
Add the following code in the module where you want to add comments:The marking method is as above
@include('laravelLikeComment::comment', ['comment_item_id' => 'video_12'])
comment_item_id:is the comment tag id of the module to be integrated.
The above is the detailed content of Teach you how to use laravel-like-comment comment plug-in. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Laravel - Artisan Commands - Laravel 5.7 comes with new way of treating and testing new commands. It includes a new feature of testing artisan commands and the demonstration is mentioned below ?

Laravel - Pagination Customizations - Laravel includes a feature of pagination which helps a user or a developer to include a pagination feature. Laravel paginator is integrated with the query builder and Eloquent ORM. The paginate method automatical

Method for obtaining the return code when Laravel email sending fails. When using Laravel to develop applications, you often encounter situations where you need to send verification codes. And in reality...

Laravel schedule task run unresponsive troubleshooting When using Laravel's schedule task scheduling, many developers will encounter this problem: schedule:run...

The method of handling Laravel's email failure to send verification code is to use Laravel...

How to implement the table function of custom click to add data in dcatadmin (laravel-admin) When using dcat...

The impact of sharing of Redis connections in Laravel framework and select methods When using Laravel framework and Redis, developers may encounter a problem: through configuration...

Laravel - Dump Server - Laravel dump server comes with the version of Laravel 5.7. The previous versions do not include any dump server. Dump server will be a development dependency in laravel/laravel composer file.
