]> BookStack Code Mirror - bookstack/blobdiff - app/Book.php
Add Carbon localization support
[bookstack] / app / Book.php
index 919af80a59e746c099aee6f5c166f7998d068575..91f74ca6428f89ae5c54c675ac5b56ed62a532e0 100644 (file)
@@ -7,11 +7,15 @@ class Book extends Entity
 
     /**
      * Get the url for this book.
+     * @param string|bool $path
      * @return string
      */
-    public function getUrl()
+    public function getUrl($path = false)
     {
-        return '/books/' . $this->slug;
+        if ($path !== false) {
+            return baseUrl('/books/' . urlencode($this->slug) . '/' . trim($path, '/'));
+        }
+        return baseUrl('/books/' . urlencode($this->slug));
     }
 
     /*