$input = $request->all();
$input['priority'] = $this->bookRepo->getNewPriority($book);
- $chapter = $this->chapterRepo->createFromInput($request->all(), $book);
+ $chapter = $this->chapterRepo->createFromInput($input, $book);
Activity::add($chapter, 'chapter_create', $book->id);
return redirect($chapter->getUrl());
}
]);
}
+ /**
+ * Perform the move action for a chapter.
+ * @param $bookSlug
+ * @param $chapterSlug
+ * @param Request $request
+ * @return mixed
+ * @throws \BookStack\Exceptions\NotFoundException
+ */
public function move($bookSlug, $chapterSlug, Request $request) {
$book = $this->bookRepo->getBySlug($bookSlug);
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
}]);
$chapterQuery = $this->permissionService->enforceChapterRestrictions($chapterQuery, 'view');
$chapters = $chapterQuery->get();
- $children = $pages->merge($chapters);
+ $children = $pages->values();
+ foreach ($chapters as $chapter) {
+ $children->push($chapter);
+ }
$bookSlug = $book->slug;
$children->each(function ($child) use ($bookSlug) {