2017 © Pedro Peláez
 

library laravel-like-comment

image

risul/laravel-like-comment

  • Wednesday, August 1, 2018
  • by risul
  • Repository
  • 10 Watchers
  • 89 Stars
  • 1,547 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 28 Forks
  • 10 Open issues
  • 8 Versions
  • 13 % Grown

The README.md

Latest Stable Version Total Downloads License, (*1)

Laravel like comment

Laravel Like Comment is a lightweight and developer-friendly package that makes it easy to add "like" and "comment" features to any Laravel model. Whether you're building a blog, forum, or social platform, this package handles the heavy lifting so you can focus on your core application., (*2)

It supports polymorphic relationships out of the box, allowing you to attach likes and comments to multiple models effortlessly. With clean API methods and customizable migrations, it's built to be both powerful and flexible., (*3)

Perfect for projects that need quick social interaction features without reinventing the wheel., (*4)

Features

  • Like
  • Dislike
  • Comment
  • Comment voting
  • User avatar in comment

Demo

Try it, (*5)

Watch, (*6)

Installation

Run, (*7)

composer require risul/laravel-like-comment

Configuration

Add, (*8)

risul\LaravelLikeComment\LikeCommentServiceProvider::class

in your service providerr list., (*9)

To copy views and migrations run, (*10)

php artisan vendor:publish

Run, (*11)

php artisan migrate

It will create like and comment table., (*12)

Add this style links to your view head, (*13)

    <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">

Add jquery and script, (*14)

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <script src="{{ asset('/vendor/laravelLikeComment/js/script.js') }}" type="text/javascript"></script>

In config/laravelLikeComment.php add user model path, (*15)

'userModel' => 'App\User'

Add following code in your user model, (*16)

    /**
     * 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
        ];
    }

Usage

Add this line at where you want to integrate Like, (*17)

@include('laravelLikeComment::like', ['like_item_id' => 'image_31'])

like_item_id: This is the id of the item,page or model for which the like will be used, (*18)

Add this line where you want to integrate Comment, (*19)

@include('laravelLikeComment::comment', ['comment_item_id' => 'video_12'])

comment_item_id: This is the id of the item, page, or model for which the comment will be used, (*20)

The Versions

01/08 2018

dev-develop

dev-develop

  Sources   Download

06/03 2018

v0.1

0.1.0.0

  Sources   Download

03/07 2017

dev-master

9999999-dev

Ajax based site wide like and comment system for laravel

  Sources   Download

MIT

by Avatar risul

laravel ajax comment like

03/07 2017

v2.0.0

2.0.0.0

Ajax based site wide like and comment system for laravel

  Sources   Download

MIT

by Avatar risul

laravel ajax comment like

27/09 2016

v1.0.3

1.0.3.0

Ajax based site wide like and comment system for laravel.

  Sources   Download

MIT

by Avatar risul

laravel ajax comment like

02/09 2016

v1.0.2

1.0.2.0

Ajax based site wide like and comment system for laravel.

  Sources   Download

MIT

by Avatar risul

laravel ajax comment like

27/08 2016

v1.0.1

1.0.1.0

Ajax based site wide like and comment system for laravel.

  Sources   Download

MIT

by Avatar risul

laravel ajax comment like

26/08 2016

v1.0.0

1.0.0.0

Ajax based site wide like and comment system for laravel.

  Sources   Download

MIT

by Avatar risul

laravel ajax comment like