|
|
@ -50,13 +50,27 @@ class LikeService {
|
|
|
|
|
|
|
|
|
|
|
|
public static function likedBy($status)
|
|
|
|
public static function likedBy($status)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
$empty = [
|
|
|
|
|
|
|
|
'username' => null,
|
|
|
|
|
|
|
|
'others' => false
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!$status) {
|
|
|
|
|
|
|
|
return $empty;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!$status->likes_count) {
|
|
|
|
if(!$status->likes_count) {
|
|
|
|
return [
|
|
|
|
return $empty;
|
|
|
|
'username' => null,
|
|
|
|
|
|
|
|
'others' => false
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$id = Like::whereStatusId($status->id)->first()->profile_id;
|
|
|
|
|
|
|
|
|
|
|
|
$like = Like::whereStatusId($status->id)->first();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!$like) {
|
|
|
|
|
|
|
|
return $empty;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$id = $like->profile_id;
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
'username' => ProfileService::get($id)['username'],
|
|
|
|
'username' => ProfileService::get($id)['username'],
|
|
|
|
'others' => $status->likes_count >= 5,
|
|
|
|
'others' => $status->likes_count >= 5,
|
|
|
|