]> _ Git - psq.git/commitdiff
distinct view count
authorLouis Jeckel <louis.jeckel@outlook.cm>
Fri, 11 Sep 2020 17:15:15 +0000 (19:15 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Fri, 11 Sep 2020 17:15:15 +0000 (19:15 +0200)
app/PdfFile.php

index 5af133eef5fcacaa8675ac2716aeb620bbd5e5f4..37938c69944d67b12ff638efd41d4e1d391e282f 100644 (file)
@@ -49,7 +49,7 @@ use Vaites\ApacheTika\Client as TikaClient;
  * @property string $title
  * @property bool $is_free
  * @property Collection $accessLogs
- * @property-read int $accessCount
+ * @property-read int $viewCount
  *
  */
 class PdfFile extends TwillModel implements Sortable
@@ -213,7 +213,7 @@ class PdfFile extends TwillModel implements Sortable
      */
     public function getViewCountAttribute()
     {
-        return $this->accessLogs()->count();
+        return $this->accessLogs()->distinct('user_id')->count();
     }