mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Fix for getting book items
This commit is contained in:
parent
1e2f5ded38
commit
b506beac64
@ -33,8 +33,10 @@ class Book extends Model
|
||||
{
|
||||
$pages = $this->pages()->where('chapter_id', '=', 0)->get();
|
||||
$chapters = $this->chapters()->get();
|
||||
$children = $pages->merge($chapters);
|
||||
return $children->sortBy('priority');
|
||||
foreach($chapters as $chapter) {
|
||||
$pages->push($chapter);
|
||||
}
|
||||
return $pages->sortBy('priority');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,8 +47,11 @@ class BookRepo
|
||||
public function destroyBySlug($bookSlug)
|
||||
{
|
||||
$book = $this->getBySlug($bookSlug);
|
||||
foreach($book->children() as $child) {
|
||||
$child->delete();
|
||||
foreach($book->pages as $page) {
|
||||
$page->delete();
|
||||
}
|
||||
foreach($book->chapters as $chapter) {
|
||||
$chapter->delete();
|
||||
}
|
||||
$book->delete();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user