Skip to content
This repository has been archived by the owner on Jul 4, 2019. It is now read-only.

Commit

Permalink
Non relevent votes
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrneDev committed May 7, 2018
1 parent 3179b19 commit f8b709f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Api/Serializers/QuestionSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ public function votes($question)
{
$votes = app(VoteRepository::class);

return new Relationship(new Collection($votes->all($question), app(VoteSerializer::class)));
return new Relationship(new Collection($votes->getReleventVotes($question->id), app(VoteSerializer::class)));
}
}
10 changes: 10 additions & 0 deletions src/Repositories/VoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,14 @@ public function all()
{
return $this->query()->get();
}

/**
* @param $questionId
*
* @return mixed
*/
public function getReleventVotes($questionId)
{
return vote::where('poll_id', $questionId)->get();
}
}

0 comments on commit f8b709f

Please sign in to comment.