public function getBySlug($slug, $bookId) { $page = $this->pageQuery()->where('slug', '=', $slug)->where('book_id', '=', $bookId)->first(); if ($page === null) { throw new NotFoundException('Page not found'); } return $page; }