]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Models/Chapter.php
Reverted shift change to old migration
[bookstack] / app / Entities / Models / Chapter.php
index 1810685335bf6910dc2486eb6410fa47e88edcca..abf496b44b38e9d3c300f1389b45e62e7c68cf45 100644 (file)
@@ -1,14 +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'];
@@ -16,7 +22,9 @@ class Chapter extends BookChild
 
     /**
      * Get the pages that this chapter contains.
+     *
      * @param string $dir
+     *
      * @return mixed
      */
     public function pages($dir = 'ASC')
@@ -31,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, '/'),