Expanded chapters interface and improved book/page deletion

This commit is contained in:
Dan Brown
2015-07-28 20:57:13 +01:00
parent b9df3c647a
commit fd1a0dceb2
19 changed files with 282 additions and 141 deletions

View File

@ -78,8 +78,7 @@ class BookController extends Controller
public function show($slug)
{
$book = $this->bookRepo->getBySlug($slug);
$pageTree = $this->pageRepo->getTreeByBookId($book->id);
return view('books/show', ['book' => $book, 'pageTree' => $pageTree]);
return view('books/show', ['book' => $book]);
}
/**
@ -118,15 +117,26 @@ class BookController extends Controller
return redirect($book->getUrl());
}
/**
* Shows the page to confirm deletion
* @param $bookSlug
* @return \Illuminate\View\View
*/
public function showDelete($bookSlug)
{
$book = $this->bookRepo->getBySlug($bookSlug);
return view('books/delete', ['book' => $book]);
}
/**
* Remove the specified book from storage.
*
* @param int $id
* @param $bookSlug
* @return Response
*/
public function destroy($id)
public function destroy($bookSlug)
{
$this->bookRepo->destroyById($id);
$this->bookRepo->destroyBySlug($bookSlug);
return redirect('/books');
}
}