@@ 135-140 (lines=6) @@ | ||
132 | */ |
|
133 | public function voteUp(Topic $topic) |
|
134 | { |
|
135 | if ($this->userUpVoted($topic->id, Auth::id())) { |
|
136 | $this->resetVote($topic->id, Auth::id()); |
|
137 | $topic->decrement('vote_count', 1); |
|
138 | ||
139 | return false; |
|
140 | } |
|
141 | ||
142 | $vote_count = 0; |
|
143 | ||
@@ 179-182 (lines=4) @@ | ||
176 | ||
177 | $vote_count = 0; |
|
178 | ||
179 | if ($this->userUpVoted($topic->id, Auth::id())) { |
|
180 | $this->resetVote($topic->id, Auth::id()); |
|
181 | $vote_count = 1; |
|
182 | } |
|
183 | ||
184 | $topic->votes()->create([ |
|
185 | 'is' => 'downvote', |