X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/fea5630ea4343b33c353afb41d502d535f674331..refs/pull/635/head:/app/Entity.php diff --git a/app/Entity.php b/app/Entity.php index efbbf0eba..df8e4d38b 100644 --- a/app/Entity.php +++ b/app/Entity.php @@ -69,14 +69,15 @@ class Entity extends Ownable /** * Get the comments for an entity - * @return \Illuminate\Database\Eloquent\Relations\MorphMany + * @param bool $orderByCreated + * @return MorphMany */ - public function comments() + public function comments($orderByCreated = true) { - return $this->morphMany(Comment::class, 'entity')->orderBy('created_at', 'asc'); + $query = $this->morphMany(Comment::class, 'entity'); + return $orderByCreated ? $query->orderBy('created_at', 'asc') : $query; } - /** * Get the related search terms. * @return \Illuminate\Database\Eloquent\Relations\MorphMany