Dan Brown

Fixed issue with the book sort not showing all books in sidebar

...@@ -157,7 +157,7 @@ class BookController extends Controller ...@@ -157,7 +157,7 @@ class BookController extends Controller
157 $this->checkPermission('book-update'); 157 $this->checkPermission('book-update');
158 $book = $this->bookRepo->getBySlug($bookSlug); 158 $book = $this->bookRepo->getBySlug($bookSlug);
159 $bookChildren = $this->bookRepo->getChildren($book); 159 $bookChildren = $this->bookRepo->getChildren($book);
160 - $books = $this->bookRepo->getAll(); 160 + $books = $this->bookRepo->getAll(false);
161 $this->setPageTitle('Sort Book ' . $book->getShortName()); 161 $this->setPageTitle('Sort Book ' . $book->getShortName());
162 return view('books/sort', ['book' => $book, 'current' => $book, 'books' => $books, 'bookChildren' => $bookChildren]); 162 return view('books/sort', ['book' => $book, 'current' => $book, 'books' => $books, 'bookChildren' => $bookChildren]);
163 } 163 }
......
...@@ -14,8 +14,8 @@ class BookRepo ...@@ -14,8 +14,8 @@ class BookRepo
14 14
15 /** 15 /**
16 * BookRepo constructor. 16 * BookRepo constructor.
17 - * @param Book $book 17 + * @param Book $book
18 - * @param PageRepo $pageRepo 18 + * @param PageRepo $pageRepo
19 * @param ChapterRepo $chapterRepo 19 * @param ChapterRepo $chapterRepo
20 */ 20 */
21 public function __construct(Book $book, PageRepo $pageRepo, ChapterRepo $chapterRepo) 21 public function __construct(Book $book, PageRepo $pageRepo, ChapterRepo $chapterRepo)
...@@ -42,7 +42,9 @@ class BookRepo ...@@ -42,7 +42,9 @@ class BookRepo
42 */ 42 */
43 public function getAll($count = 10) 43 public function getAll($count = 10)
44 { 44 {
45 - return $this->book->orderBy('name', 'asc')->take($count)->get(); 45 + $bookQuery = $this->book->orderBy('name', 'asc');
46 + if (!$count) return $bookQuery->get();
47 + return $bookQuery->take($count)->get();
46 } 48 }
47 49
48 /** 50 /**
...@@ -159,7 +161,7 @@ class BookRepo ...@@ -159,7 +161,7 @@ class BookRepo
159 } 161 }
160 162
161 /** 163 /**
162 - * @param string $slug 164 + * @param string $slug
163 * @param bool|false $currentId 165 * @param bool|false $currentId
164 * @return bool 166 * @return bool
165 */ 167 */
...@@ -175,7 +177,7 @@ class BookRepo ...@@ -175,7 +177,7 @@ class BookRepo
175 /** 177 /**
176 * Provides a suitable slug for the given book name. 178 * Provides a suitable slug for the given book name.
177 * Ensures the returned slug is unique in the system. 179 * Ensures the returned slug is unique in the system.
178 - * @param string $name 180 + * @param string $name
179 * @param bool|false $currentId 181 * @param bool|false $currentId
180 * @return string 182 * @return string
181 */ 183 */
......