]> BookStack Code Mirror - bookstack/blobdiff - app/Entities/Models/Book.php
Minor capitalisation fix for Estonian
[bookstack] / app / Entities / Models / Book.php
index 6c56767655c894b22c548e7ff552a07f36940ea6..1e4591bd75d3f385e5a4cffe217b5f8c7f643f2c 100644 (file)
@@ -1,4 +1,6 @@
-<?php namespace BookStack\Entities\Models;
+<?php
+
+namespace BookStack\Entities\Models;
 
 use BookStack\Uploads\Image;
 use Exception;
@@ -8,10 +10,14 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
 use Illuminate\Support\Collection;
 
 /**
- * Class Book
- * @property string $description
- * @property int $image_id
- * @property Image|null $cover
+ * Class Book.
+ *
+ * @property string                                   $description
+ * @property int                                      $image_id
+ * @property Image|null                               $cover
+ * @property \Illuminate\Database\Eloquent\Collection $chapters
+ * @property \Illuminate\Database\Eloquent\Collection $pages
+ * @property \Illuminate\Database\Eloquent\Collection $directPages
  */
 class Book extends Entity implements HasCoverImage
 {
@@ -30,8 +36,10 @@ class Book extends Entity implements HasCoverImage
 
     /**
      * Returns book cover image, if book cover not exists return default cover image.
-     * @param int $width - Width of the image
+     *
+     * @param int $width  - Width of the image
      * @param int $height - Height of the image
+     *
      * @return string
      */
     public function getBookCover($width = 440, $height = 250)
@@ -46,11 +54,12 @@ class Book extends Entity implements HasCoverImage
         } catch (Exception $err) {
             $cover = $default;
         }
+
         return $cover;
     }
 
     /**
-     * Get the cover image of the book
+     * Get the cover image of the book.
      */
     public function cover(): BelongsTo
     {
@@ -67,6 +76,7 @@ class Book extends Entity implements HasCoverImage
 
     /**
      * Get all pages within this book.
+     *
      * @return HasMany
      */
     public function pages()
@@ -76,6 +86,7 @@ class Book extends Entity implements HasCoverImage
 
     /**
      * Get the direct child pages of this book.
+     *
      * @return HasMany
      */
     public function directPages()
@@ -85,6 +96,7 @@ class Book extends Entity implements HasCoverImage
 
     /**
      * Get all chapters within this book.
+     *
      * @return HasMany
      */
     public function chapters()
@@ -94,6 +106,7 @@ class Book extends Entity implements HasCoverImage
 
     /**
      * Get the shelves this book is contained within.
+     *
      * @return BelongsToMany
      */
     public function shelves()
@@ -103,12 +116,14 @@ class Book extends Entity implements HasCoverImage
 
     /**
      * Get the direct child items within this book.
+     *
      * @return Collection
      */
     public function getDirectChildren(): Collection
     {
         $pages = $this->directPages()->visible()->get();
         $chapters = $this->chapters()->visible()->get();
+
         return $pages->concat($chapters)->sortBy('priority')->sortByDesc('draft');
     }
 }