]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Page.php
Show bookshelves that a book belongs to on a book view
[bookstack] / app / Entities / Page.php
index 1c2cc5cff69c29daa5385d963bc89ab2ad4612ff..752b3c9ddd7cd973eb8dc1166601503e12f09db8 100644 (file)
@@ -2,7 +2,7 @@
 
 use BookStack\Uploads\Attachment;
 
-class Page extends Entity
+class Page extends BookChild
 {
     protected $fillable = ['name', 'html', 'priority', 'markdown'];
 
@@ -30,15 +30,6 @@ class Page extends Entity
         return $array;
     }
 
-    /**
-     * Get the book this page sits in.
-     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
-     */
-    public function book()
-    {
-        return $this->belongsTo(Book::class);
-    }
-
     /**
      * Get the parent item
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
@@ -96,10 +87,10 @@ class Page extends Entity
         $idComponent = $this->draft ? $this->id : urlencode($this->slug);
 
         if ($path !== false) {
-            return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/'));
+            return url('/books/' . urlencode($bookSlug) . $midText . $idComponent . '/' . trim($path, '/'));
         }
 
-        return baseUrl('/books/' . urlencode($bookSlug) . $midText . $idComponent);
+        return url('/books/' . urlencode($bookSlug) . $midText . $idComponent);
     }
 
     /**