From 55aeab2733e89544fd28787290fb42e67bda82fd Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 12 Jul 2018 10:40:25 -0600 Subject: [PATCH] Update Profile model --- app/Profile.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Profile.php b/app/Profile.php index 009ed2cbf..91475ca7d 100644 --- a/app/Profile.php +++ b/app/Profile.php @@ -29,6 +29,15 @@ class Profile extends Model } public function url($suffix = '') + { + if($this->remote_url) { + return $this->remote_url; + } else { + return url($this->username . $suffix); + } + } + + public function localUrl($suffix = '') { return url($this->username . $suffix); } @@ -124,4 +133,9 @@ class Profile extends Model $url = url(Storage::url($this->avatar->media_path ?? 'public/avatars/default.png')); return $url; } + + public function statusCount() + { + return $this->statuses()->whereHas('media')->count(); + } }