mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-18 22:31:04 +00:00
Added better entity deletion and commented up repos
This commit is contained in:
parent
ea55b7f141
commit
61ae96c5f8
10 changed files with 155 additions and 34 deletions
app/Http/Controllers
|
@ -146,15 +146,8 @@ class ChapterController extends Controller
|
|||
$this->checkPermission('chapter-delete');
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
if (count($chapter->pages) > 0) {
|
||||
foreach ($chapter->pages as $page) {
|
||||
$page->chapter_id = 0;
|
||||
$page->save();
|
||||
}
|
||||
}
|
||||
Activity::removeEntity($chapter);
|
||||
Activity::addMessage('chapter_delete', $book->id, $chapter->name);
|
||||
$chapter->delete();
|
||||
$this->chapterRepo->destroy($chapter);
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue