Update LikeController, improve query perf

pull/2895/head
Daniel Supernault 4 years ago
parent 14a1367a8f
commit f3d6023ef8
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -29,8 +29,7 @@ class LikeController extends Controller
$profile = $user->profile;
$status = Status::findOrFail($request->input('item'));
if ($status->likes()->whereProfileId($profile->id)->count() !== 0) {
if (Like::whereStatusId($status->id)->whereProfileId($profile->id)->exists()) {
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
UnlikePipeline::dispatch($like);
} else {

Loading…
Cancel
Save