public function countVoters($type = null)
    {
        $voters = $this->voters();

        if(!is_null($type)) $voters->wherePivot('type', $type);

        return $voters->count();
    }
public function countVoters($type = null)
    {
        $voters = $this->voters();

        if(!is_null($type)) $voters->wherePivot('type', $type);

        return $voters->count();
    }
public function countVoters ( $ type = null ) { $ voters = $ this -> voters ( ) ; if ( ! is_null ( $ type ) ) $ voters -> wherePivot ( 'type' , $ type ) ; return $ voters -> count ( ) ; }
Count the number of voters.

@param  string $type

@return int
Count the number of voters .