PHPackages                             craigzearfoss/user-ratings - 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. [Database &amp; ORM](/categories/database)
4. /
5. craigzearfoss/user-ratings

ActiveLibrary[Database &amp; ORM](/categories/database)

craigzearfoss/user-ratings
==========================

Add user ratings to Laravel 5.1 Eloquent models.

297PHP

Since Jan 15Pushed 9y ago2 watchersCompare

[ Source](https://github.com/craigzearfoss/user-ratings)[ Packagist](https://packagist.org/packages/craigzearfoss/user-ratings)[ RSS](/packages/craigzearfoss-user-ratings/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

User Ratings for Laravel 5
==========================

[](#user-ratings-for-laravel-5)

This package allows you to attach user ratings an Eloquent model in [**Laravel 5**](http://laravel.com/). The ratings include an integer field for a numeric rating; boolean fields for like, dislike and favorite and a text field for a comment.

Composer Install
----------------

[](#composer-install)

It can be found on [Packagist](https://packagist.org/packages/craigzeaross/user-ratings). The recommended way is through [composer](http://getcomposer.org).

Edit `composer.json` and add:

```
{
    "require": {
        "craigzearfoss/user-ratings": "dev-master"
    }
}
```

And install dependencies:

```
$ composer update
```

If you do not have [**Composer**](https://getcomposer.org) installed, run these two commands:

```
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar install
```

Install and then Run the migrations
-----------------------------------

[](#install-and-then-run-the-migrations)

Find the `providers` array key in `config/app.php` and register the **User Ratings Service Provider**.

```
'providers' => array(
    // ...

    Craigzearfoss\UserRatings\UserRatingsServiceProvider::class,
)
```

Run the migration to create the `user_ratings` table.

```
php artisan vendor:publish --provider="Craigzearfoss\UserRatings\Providers\UserRatingsServiceProvider"
php artisan migrate
```

Configuration
-------------

[](#configuration)

In your model add the UserRatableTrait.

```
