PHP code example of daydevelops / vote

1. Go to this page and download the library: Download daydevelops/vote 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/ */

    

daydevelops / vote example snippets

 bash
$ composer endor:publish
$ php artisan migrate
 
$this->upVote(); // alias of $this->vote('up'); 
 
$this->downVote(); // alias of $this->vote('down'); 
 
$this->unVote(); 
 
$this->hasVoted(); 
 
$this->hasUpVoted(); 
 
$this->hasDownVoted(); 
 
$this->votes(); // hasMany relationship
 
$this->score; 
 
$this->isVoter(); 
 
$this->makeVoter($change); // optional signed int $change is added to the default voter weight (see config/vote.php) upon creation 
 
$this->votable_score;