From 203034b97150690d2c648a8aeb7da0e777154e25 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 9 Aug 2018 20:57:06 -0600 Subject: [PATCH] Update Status model, add new methods --- app/Status.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/Status.php b/app/Status.php index 50487e46..5deb6995 100644 --- a/app/Status.php +++ b/app/Status.php @@ -52,6 +52,14 @@ class Status extends Model return url($path); } + public function permalink($suffix = '/activity') + { + $id = $this->id; + $username = $this->profile->username; + $path = config('app.url') . "/p/{$username}/{$id}{$suffix}"; + return url($path); + } + public function editUrl() { return $this->url() . '/edit'; @@ -174,4 +182,9 @@ class Status extends Model return "{$actorName} " . __('notification.commented'); } + + public function recentComments() + { + return $this->comments()->orderBy('created_at','desc')->take(3); + } }