Download the PHP package se468/laravel-ratings without Composer
On this page you can find all versions of the php package se468/laravel-ratings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package laravel-ratings
Laravel Ratings Engine
Ratings engine for Laravel using polymorphic relationships.
DEMO : here
Installation
composer require se468/laravel-ratings
php artisan migrate
to migrate the tables- Add
CanReceiveRatings
trait to your model that receives Ratings (App\User
,App\Company
,App\Project
.. whatever you need to receive ratings for) and implementRatingReceivable
interface to the model. - Add
CanGiveRatings
trait to your model that needs to give Ratings (UsuallyApp\User
).
Example (CanGiveRatings):
Example (CanReceiveRatings):
Usage
Basic Usage Example
CanReceiveRatings Trait
Getting all ratings:
Getting overall (average) rating:
CanGiveRatings Trait
Getting ratings given by this:
Giving a rating:
Rating
You can change rater
function in Rating
model if you want something other than App\User
to give ratings.
All versions of laravel-ratings with dependencies
PHP Build Version
Package Version
The package se468/laravel-ratings contains the following files
Loading the files please wait ....