]> BookStack Code Mirror - bookstack/blobdiff - app/Repos/CommentRepo.php
Added ability to configure email sender name
[bookstack] / app / Repos / CommentRepo.php
index c3d7468cfb811dbee33cc057d097de471b8bb6ed..7f89e7f8dfb3011eabbf60aca05c8fd5b5c3451d 100644 (file)
@@ -7,7 +7,8 @@ use BookStack\Entity;
  * Class CommentRepo
  * @package BookStack\Repos
  */
-class CommentRepo {
+class CommentRepo
+{
 
     /**
      * @var Comment $comment
@@ -39,7 +40,7 @@ class CommentRepo {
      * @param array $data
      * @return Comment
      */
-    public function create (Entity $entity, $data = [])
+    public function create(Entity $entity, $data = [])
     {
         $userId = user()->id;
         $comment = $this->comment->newInstance($data);
@@ -80,8 +81,10 @@ class CommentRepo {
      */
     protected function getNextLocalId(Entity $entity)
     {
-        $comments = $entity->comments()->orderBy('local_id', 'desc')->first();
-        if ($comments === null) return 1;
+        $comments = $entity->comments(false)->orderBy('local_id', 'desc')->first();
+        if ($comments === null) {
+            return 1;
+        }
         return $comments->local_id + 1;
     }
-}
\ No newline at end of file
+}