Prevented custom homepage being deleted

Fixes #546
This commit is contained in:
Dan Brown
2017-10-15 19:14:46 +01:00
parent a988438946
commit db51cee2d8
4 changed files with 35 additions and 2 deletions

View File

@ -324,9 +324,10 @@ class PageController extends Controller
$page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
$book = $page->book;
$this->checkOwnablePermission('page-delete', $page);
$this->entityRepo->destroyPage($page);
Activity::addMessage('page_delete', $book->id, $page->name);
session()->flash('success', trans('entities.pages_delete_success'));
$this->entityRepo->destroyPage($page);
return redirect($book->getUrl());
}