mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-21 22:36:05 +08:00
Fixed entity messages on delete. Fixes #21.
This commit is contained in:
@ -137,15 +137,15 @@ class ChapterController extends Controller
|
||||
{
|
||||
$book = $this->bookRepo->getBySlug($bookSlug);
|
||||
$chapter = $this->chapterRepo->getBySlug($chapterSlug, $book->id);
|
||||
$chapterName = $chapter->name;
|
||||
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();
|
||||
Activity::addMessage('chapter_delete', $book->id, $chapterName);
|
||||
return redirect($book->getUrl());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user