Download the PHP package eslamfaroug/laravel-like-dislike without Composer
On this page you can find all versions of the php package eslamfaroug/laravel-like-dislike. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eslamfaroug/laravel-like-dislike
More information about eslamfaroug/laravel-like-dislike
Files in eslamfaroug/laravel-like-dislike
Package laravel-like-dislike
Short Description 👍 User like/dislike features for Laravel Application.
License MIT
Informations about the package laravel-like-dislike
Laravel Like
👍 User-like features for Laravel Application.
Installing
Configuration
This step is optional
Migrations
This step is also optional, if you want to custom likes table, you can publish the migration files:
Usage
Traits
EslamFaroug\LaravelLikeDislike\Traits\Liker
EslamFaroug\LaravelLikeDislike\Traits\Likeable
API
Get user likes with pagination:
Get object likers:
with pagination:
Aggregations
List with *_count
attribute:
N+1 issue
To avoid the N+1 issue, you can use eager loading to reduce this operation to just 2 queries. When querying, you may specify which relationships should be eager loaded using the with
method:
Of course we have a better solution, which can be found in the following section:
Attach user like status to likeable collection
You can use Liker::attachLikeStatus($likeables)
to attach the user like status, it will attach has_liked
attribute to each model of $likeables
:
For model
For Collection | Paginator | LengthAwarePaginator | array
:
For pagination
Troubleshooting
If you encounter any issues or need help, please refer to the Troubleshooting section in the documentation for assistance.
Contributing
Contributions are welcome! If you'd like to contribute to
the Laravel Like System Package, please follow the guidelines in the Contributing section of the documentation.
License
The Laravel Like System Package is open-source software licensed under the MIT license.
This concludes the documentation for the Laravel Like System Package. For more information and detailed usage instructions, please refer to the sections above. If you have any questions or need further assistance, don't hesitate to reach out to the package author or community for support.
We hope you find the Laravel Like System Package a valuable addition to your Laravel projects! Happy coding!