mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-29 09:21:20 +03: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();
|
$pages = $this->pages()->where('chapter_id', '=', 0)->get();
|
||||||
$chapters = $this->chapters()->get();
|
$chapters = $this->chapters()->get();
|
||||||
$children = $pages->merge($chapters);
|
foreach($chapters as $chapter) {
|
||||||
return $children->sortBy('priority');
|
$pages->push($chapter);
|
||||||
|
}
|
||||||
|
return $pages->sortBy('priority');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,11 @@ class BookRepo
|
|||||||
public function destroyBySlug($bookSlug)
|
public function destroyBySlug($bookSlug)
|
||||||
{
|
{
|
||||||
$book = $this->getBySlug($bookSlug);
|
$book = $this->getBySlug($bookSlug);
|
||||||
foreach($book->children() as $child) {
|
foreach($book->pages as $page) {
|
||||||
$child->delete();
|
$page->delete();
|
||||||
|
}
|
||||||
|
foreach($book->chapters as $chapter) {
|
||||||
|
$chapter->delete();
|
||||||
}
|
}
|
||||||
$book->delete();
|
$book->delete();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user