PHPackages                             ayham/like - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ayham/like

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ayham/like
==========

Like - A simple laravel package to add likes

1.0.0(2y ago)07MITPHPPHP &gt;=8.2

Since Mar 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Ayham-Ibrahim/like-package-laravel)[ Packagist](https://packagist.org/packages/ayham/like)[ RSS](/packages/ayham-like/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Provides a trait to allow adding reaction (like) of any Eloquent models within your app

#### note : this trait for toggle like (click on button to add like and click on the same button to remove like (Similar to the like button on Instagram))

[](#note--this-trait-for-toggle-like-click-on-button-to-add-like-and-click-on-the-same-button-to-remove-like-similar-to-the-like-button-on-instagram)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ayham/like
```

You can publish the migrations with:

```
php artisan vendor:publish --provider="Ayham\Like\Provider\LikeServiceProvider" --tag="migrations"
```

After that run the migrations:

```
php artisan migrate
```

As with most Laravel packages, if you're using Laravel 5.5 or later, the package will be auto-discovered ([learn more if this is new to you](https://medium.com/@taylorotwell/package-auto-discovery-in-laravel-5-5-ea9e3ab20518)).

If you're using a version of Laravel before 5.5, you'll need to register the Rateable *service provider*. In your `config/app.php` add `    Ayham\Like\Provider\LikeServiceProvider::class` to the end of the `$providers` array.

```
'providers' => [

    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...
    Ayham\Like\Provider\LikeServiceProvider::class,

],
```

Usage
-----

[](#usage)

If I want to give the user the ability to add a reaction "like" to liking a model , import the `Likeable` trait in the model.

```
