Skip to content

Pandahisham/Laravel-Voteable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Voteable

Use At Your Own Risk - Not Maintained!


Installation

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

Setup a Model

<?php

namespace App;

use DraperStudio\Voteable\Traits\Voteable;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use Voteable;
}

Sum of all votes

Vote::sum($user);

Count all votes

Vote::count($user);

Count all up-votes

Vote::countUps($user);

Count all down-votes

Vote::countDowns($user);

Count all votes between two dates

Vote::countByDate($user, '2015-06-30', '2015-06-31');

Up-vote

Vote::up($user);

Down-vote

Vote::down($user);

About

Use At Your Own Risk - Not Maintained!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages