Update LikeService, skip self likes

This commit is contained in:
Daniel Supernault 2021-06-23 21:26:45 -06:00
parent cc47243733
commit 3741c76da3
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -62,8 +62,16 @@ class LikeService {
if(!$status->likes_count) { if(!$status->likes_count) {
return $empty; 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) { if(!$like) {
return $empty; return $empty;