From: Louis Jeckel Date: Fri, 11 Sep 2020 17:15:15 +0000 (+0200) Subject: distinct view count X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7fdac1b3f344a2a1691eac59adfe2a0a691bd4e4;p=psq.git distinct view count --- diff --git a/app/PdfFile.php b/app/PdfFile.php index 5af133e..37938c6 100644 --- a/app/PdfFile.php +++ b/app/PdfFile.php @@ -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(); }