1. Go to this page and download the library: Download zvermafia/lavoter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
class EncryptCookies extends BaseEncrypter
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
'lavoter_uuid',
];
}
namespace App;
use Zvermafia\Lavoter\Contracts\Voteable;
use Zvermafia\Lavoter\Traits\Voteable as VoteableTrait;
use Illuminate\Database\Eloquent\Model;
class Article extends Model implements Voteable
{
use VoteableTrait;
}
// Before you need to import a Vote model
use Zvermafia\Lavoter\Models\Vote;
// Up-vote
Vote::up($article, $uuid);
// Down-vote
Vote::down($article, $uuid);