PHPackages                             imagina/laravel-rateable - 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. imagina/laravel-rateable

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

imagina/laravel-rateable
========================

Allows multiple models to be rated with a fivestar like system.

2.3(5y ago)023MITPHPPHP &gt;=7.2

Since Aug 27Pushed 5y agoCompare

[ Source](https://github.com/imagina/laravel-rateable)[ Packagist](https://packagist.org/packages/imagina/laravel-rateable)[ Docs](https://github.com/willvincent/laravel-rateable)[ RSS](/packages/imagina-laravel-rateable/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (16)Used By (0)

Laravel Rateable
================

[](#laravel-rateable)

[![Build Status](https://camo.githubusercontent.com/3aee4018f9693cab9f0e22d5791fafea631bedb7179d7d7d02c67f6bcb16f51e/68747470733a2f2f7472617669732d63692e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/willvincent/laravel-rateable)[![Latest Stable Version](https://camo.githubusercontent.com/dc70afade43a75039b69dad022e39f3fa151a8e03213d52dc51c07641638a350/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f762f737461626c652e737667)](https://packagist.org/packages/willvincent/laravel-rateable) [![License](https://camo.githubusercontent.com/08a1455777273114aff249b4d96cc81fcc1adbaaa6aa3f46336055045d6f93bc/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f6c6963656e73652e737667)](https://packagist.org/packages/willvincent/laravel-rateable)

[![Total Downloads](https://camo.githubusercontent.com/f0164160e58ebcd9c2b2ca42d0d6c9b167f462906b9fc3b58b8182f217c0ffc9/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/willvincent/laravel-rateable) [![Monthly Downloads](https://camo.githubusercontent.com/950099de28209d45de75110cd069e0d709d86d19db71e0c680589d052cf837e5/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/willvincent/laravel-rateable) [![Daily Downloads](https://camo.githubusercontent.com/d00d084e9aecd23bce75932bc748d3b2a41d3b7cd0a7ee8fd7e051ef223e70b6/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652f642f6461696c792e706e67)](https://packagist.org/packages/willvincent/laravel-rateable)

Provides a trait to allow rating of any Eloquent models within your app for Laravel 6/7.

Ratings could be fivestar style, or simple +1/-1 style.

Compatability
-------------

[](#compatability)

Laravel versions &lt; 6.x should use the 1.x releases While 2.x release may at least temporarily work with most recent laravel 5.x versions, any new development will be explicitly focused on laravel 6.x+ compatibility and breaking changes may occur, therefore, installation of 2.x releases with laravel versions &lt; 6.x is not recommended, and done at your own peril.

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

[](#installation)

You can install the package via composer:

```
composer require willvincent/laravel-rateable
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="willvincent\Rateable\RateableServiceProvider" --tag="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 `'willvincent\Rateable\RateableServiceProvider'` to the end of the `$providers` array.

```
'providers' => [

    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...
    willvincent\Rateable\RateableServiceProvider::class,

],
```

Usage
-----

[](#usage)

In order to mark a model as "rateable", import the `Rateable` trait.

```
