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

ActiveLibrary

muyaedward/rateable-laravel
===========================

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

3.1(6y ago)0105MITPHPPHP &gt;=7.0CI failing

Since Nov 15Pushed 6y ago1 watchersCompare

[ Source](https://github.com/muyaedward/rateable-laravel)[ Packagist](https://packagist.org/packages/muyaedward/rateable-laravel)[ RSS](/packages/muyaedward-rateable-laravel/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (3)Versions (5)Used By (0)

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

[](#rateable-laravel)

[![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 any Eloquent models within your app for Laravel 5.

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

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

[](#installation)

Require the package using Composer:

```
composer require muyaedward/rateable-laravel

```

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 `'muyaedward\Rateable\RateableServiceProvider'` to the end of the `$providers` array.

```
'providers' => [

    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    ...
    muyaedward\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)

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

```
