]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Models/Chapter.php
Applied StyleCI changes, added php/larastan to attribution
[bookstack] / app / Entities / Models / Chapter.php
index 257b19e37e45afe981ffeb7cf6ccfcd82cdefec3..abf496b44b38e9d3c300f1389b45e62e7c68cf45 100644 (file)
@@ -1,13 +1,20 @@
-<?php namespace BookStack\Entities\Models;
+<?php
 
+namespace BookStack\Entities\Models;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Support\Collection;
 
 /**
- * Class Chapter
+ * Class Chapter.
+ *
  * @property Collection<Page> $pages
+ * @property mixed description
  */
 class Chapter extends BookChild
 {
+    use HasFactory;
+
     public $searchFactor = 1.3;
 
     protected $fillable = ['name', 'description', 'priority', 'book_id'];
@@ -15,7 +22,9 @@ class Chapter extends BookChild
 
     /**
      * Get the pages that this chapter contains.
+     *
      * @param string $dir
+     *
      * @return mixed
      */
     public function pages($dir = 'ASC')
@@ -30,7 +39,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, '/'),