From 3741c76da3b8f4d1463951fcde657edea963ce74 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 23 Jun 2021 21:26:45 -0600 Subject: [PATCH] Update LikeService, skip self likes --- app/Services/LikeService.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Services/LikeService.php b/app/Services/LikeService.php index 063266642..20ccac380 100644 --- a/app/Services/LikeService.php +++ b/app/Services/LikeService.php @@ -62,8 +62,16 @@ class LikeService { if(!$status->likes_count) { return $empty; } + $user = request()->user(); - $like = Like::whereStatusId($status->id)->first(); + if($user) { + $like = Like::whereStatusId($status->id) + ->where('profile_id', '!=', $user->profile_id) + ->first(); + } else { + $like = Like::whereStatusId($status->id) + ->first(); + } if(!$like) { return $empty;