Download the PHP package jimchen/laravel-vote without Composer
On this page you can find all versions of the php package jimchen/laravel-vote. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download jimchen/laravel-vote
More information about jimchen/laravel-vote
Files in jimchen/laravel-vote
Download jimchen/laravel-vote
More information about jimchen/laravel-vote
Files in jimchen/laravel-vote
Vendor jimchen
Package laravel-vote
Short Description The package helps you to add user based vote system to your model
License MIT
Package laravel-vote
Short Description The package helps you to add user based vote system to your model
License MIT
Please rate this library. Is it a good library?
Informations about the package laravel-vote
Laravel Vote System
:tada: This package helps you to add user based vote system to your model.
fork from jcc/laravel-vote
Installation
You can install the package using Composer:
Then add the service provider to config/app.php
:
Publish the migrations file:
Finally, use VoteTrait in User model:
Or use CanBeVoted in Comment model:
Usage
For User model
Up vote a comment or comments
Down vote a comment or comments
Cancel vote a comment or comments
Get user has voted comment items
Check if user has up or down vote
Check if user has up vote
Check if user has down vote
For Comment model
Get comment voters
Count comment voters
Get comment up voters
Count comment up voters
Get comment down voters
Count comment down voters
Check if voted by
Check if up voted by
Check if down voted by
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:
Events
Event | Description |
---|---|
JimChen\LaravelVote\Events\Voted |
Triggered when the relationship is created or updated. |
JimChen\LaravelVote\Events\CancelVoted |
Triggered when the relationship is deleted. |
Reference
License
MIT
All versions of laravel-vote with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.2
laravel/framework Version ^5.5|~6.0|~7.0|~8.0
symfony/polyfill-php80 Version ^1.22
laravel/framework Version ^5.5|~6.0|~7.0|~8.0
symfony/polyfill-php80 Version ^1.22
The package jimchen/laravel-vote contains the following files
Loading the files please wait ....