]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Models/Chapter.php
Fixes for CodeStyle vol.2
[bookstack] / app / Entities / Models / Chapter.php
index fc1d2c9d56be18913983340f32bc97e4684207bc..f6f8427a3a0050e6908250cab0be9fdf9491878d 100644 (file)
@@ -1,21 +1,27 @@
-<?php namespace BookStack\Entities\Models;
+<?php
+
+namespace BookStack\Entities\Models;
 
 use Illuminate\Support\Collection;
 
 /**
- * Class Chapter
+ * Class Chapter.
+ *
  * @property Collection<Page> $pages
+ * @property mixed description
  */
 class Chapter extends BookChild
 {
     public $searchFactor = 1.3;
 
     protected $fillable = ['name', 'description', 'priority', 'book_id'];
-    protected $hidden = ['restricted', 'pivot'];
+    protected $hidden = ['restricted', 'pivot', 'deleted_at'];
 
     /**
      * Get the pages that this chapter contains.
+     *
      * @param string $dir
+     *
      * @return mixed
      */
     public function pages($dir = 'ASC')
@@ -30,7 +36,7 @@ class Chapter extends BookChild
     {
         $parts = [
             'books',
-            urlencode($this->getAttribute('bookSlug') ?? $this->book->slug),
+            urlencode($this->book_slug ?? $this->book->slug),
             'chapter',
             urlencode($this->slug),
             trim($path, '/'),
@@ -39,15 +45,6 @@ class Chapter extends BookChild
         return url('/' . implode('/', $parts));
     }
 
-    /**
-     * Check if this chapter has any child pages.
-     * @return bool
-     */
-    public function hasChildren()
-    {
-        return count($this->pages) > 0;
-    }
-
     /**
      * Get the visible pages in this chapter.
      */