Use At Your Own Risk - Not Maintained!
First, pull in the package through Composer.
"require": {
"draperstudio/laravel-voteable": "~1.0"
}
And then include the service provider within app/config/app.php
.
'providers' => [
'DraperStudio\Voteable\VoteableServiceProvider'
];
At last you need to publish and run the migration.
php artisan vendor:publish && php artisan migrate
<?php
namespace App;
use DraperStudio\Voteable\Traits\Voteable;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use Voteable;
}
Vote::sum($user);
Vote::count($user);
Vote::countUps($user);
Vote::countDowns($user);
Vote::countByDate($user, '2015-06-30', '2015-06-31');
Vote::up($user);
Vote::down($user);