namespace BookStack\Entities\Controllers;
use BookStack\Activity\ActivityType;
-use BookStack\Entities\Repos\BookRepo;
+use BookStack\Entities\Queries\BookQueries;
use BookStack\Entities\Tools\BookContents;
use BookStack\Entities\Tools\BookSortMap;
use BookStack\Facades\Activity;
class BookSortController extends Controller
{
- protected $bookRepo;
-
- public function __construct(BookRepo $bookRepo)
- {
- $this->bookRepo = $bookRepo;
+ public function __construct(
+ protected BookQueries $queries,
+ ) {
}
/**
*/
public function show(string $bookSlug)
{
- $book = $this->bookRepo->getBySlug($bookSlug);
+ $book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$this->checkOwnablePermission('book-update', $book);
$bookChildren = (new BookContents($book))->getTree(false);
*/
public function showItem(string $bookSlug)
{
- $book = $this->bookRepo->getBySlug($bookSlug);
+ $book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$bookChildren = (new BookContents($book))->getTree();
return view('books.parts.sort-box', ['book' => $book, 'bookChildren' => $bookChildren]);
*/
public function update(Request $request, string $bookSlug)
{
- $book = $this->bookRepo->getBySlug($bookSlug);
+ $book = $this->queries->findVisibleBySlugOrFail($bookSlug);
$this->checkOwnablePermission('book-update', $book);
// Return if no map sent