]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Book.php
Added experimental breadcrumb traversal
[bookstack] / app / Entities / Book.php
index 3bce3860c9572119bd7997b421e161c96d7c4197..e722c4b107dc5dd3ea1262b7672e14bc7f9ef32e 100644 (file)
@@ -69,6 +69,15 @@ class Book extends Entity
         return $this->hasMany(Page::class);
     }
 
+    /**
+     * Get the direct child pages of this book.
+     * @return \Illuminate\Database\Eloquent\Relations\HasMany
+     */
+    public function directPages()
+    {
+        return $this->pages()->where('chapter_id', '=', '0');
+    }
+
     /**
      * Get all chapters within this book.
      * @return \Illuminate\Database\Eloquent\Relations\HasMany