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

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

zhenhai/laravel-rateable
========================

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

1.0.5(9y ago)0140MITPHPPHP &gt;=5.4

Since Aug 27Pushed 9y ago1 watchersCompare

[ Source](https://github.com/zhenfdfs/laravel-rateable)[ Packagist](https://packagist.org/packages/zhenhai/laravel-rateable)[ RSS](/packages/zhenhai-laravel-rateable/feed)WikiDiscussions master Synced 3w ago

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

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

[](#laravel-rateable)

[![Build Status](https://camo.githubusercontent.com/3aee4018f9693cab9f0e22d5791fafea631bedb7179d7d7d02c67f6bcb16f51e/68747470733a2f2f7472617669732d63692e6f72672f77696c6c76696e63656e742f6c61726176656c2d7261746561626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/willvincent/laravel-rateable)[![SensioLabsInsight](https://camo.githubusercontent.com/e3c69efb2b7a7ac3c4ba764c801cb83ddef8133636b9c30189fc1a585a840c55/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f30386435326535662d653133622d343264622d626633662d3832316434303035653661362e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/08d52e5f-e13b-42db-bf3f-821d4005e6a6)[![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 multiple models within your app for Laravel 5.

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

Installation
============

[](#installation)

Edit your project's composer.json file to require `willvincent/laravel-rateable`.

```
"require": {
  "willvincent/laravel-rateable": "~1.0"
}

```

Next, update Composer from the terminal.

```
composer update

```

As with most Laravel packages you'll need to register 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,

],
```

Getting started
===============

[](#getting-started)

After the package is correctly installed, you need to generate the migration.

```
php artisan rateable:migration

```

It will generate the `_create_ratings_table.php` migration. You may now run it with the artisan migrate command:

```
php artisan migrate

```

After the migration, one new table will be present, `ratings`.

Usage
=====

[](#usage)

You need to set on your model that it is rateable.

```
