Skip to content

Use At Your Own Risk - Not Maintained!

License

Notifications You must be signed in to change notification settings

Pandahisham/Laravel-Voteable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
DraperStudio
Jul 1, 2015
ecb6f81 · Jul 1, 2015

History

1 Commit
Jul 1, 2015
Jul 1, 2015
Jul 1, 2015
Jul 1, 2015
Jul 1, 2015
Jul 1, 2015
Jul 1, 2015

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

Stars

Watchers

Forks