소스 검색

Update Profile model

Daniel Supernault 6 년 전
부모
커밋
b92cc8f41e
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      app/Profile.php

+ 6 - 1
app/Profile.php

@@ -143,7 +143,11 @@ class Profile extends Model
 
     public function statusCount()
     {
-        return $this->statuses()->whereHas('media')->count();
+        return $this->statuses()
+        ->whereHas('media')
+        ->whereNull('in_reply_to_id')
+        ->whereNull('reblog_of_id')
+        ->count();
     }
 
     public function recommendFollowers()
@@ -159,6 +163,7 @@ class Profile extends Model
             ->whereNotIn('following_id', $follows)
             ->whereIn('profile_id', $following)
             ->orderByRaw('rand()')
+            ->distinct('id')
             ->limit(3)
             ->pluck('following_id');
         $recommended = [];