| @@ 144-147 (lines=4) @@ | ||
| 141 | ||
| 142 | $vote_count = 0; |
|
| 143 | ||
| 144 | if ($this->userDownVoted($topic->id, Auth::id())) { |
|
| 145 | $this->resetVote($topic->id, Auth::id()); |
|
| 146 | $vote_count = 1; |
|
| 147 | } |
|
| 148 | ||
| 149 | $topic->votes()->create([ |
|
| 150 | 'is' => 'upvote', |
|
| @@ 170-175 (lines=6) @@ | ||
| 167 | */ |
|
| 168 | public function voteDown(Topic $topic) |
|
| 169 | { |
|
| 170 | if ($this->userDownVoted($topic->id, Auth::id())) { |
|
| 171 | $this->resetVote($topic->id, Auth::id()); |
|
| 172 | $topic->increment('vote_count', 1); |
|
| 173 | ||
| 174 | return false; |
|
| 175 | } |
|
| 176 | ||
| 177 | $vote_count = 0; |
|
| 178 | ||