+ * Search through page revisions and retrieve
+ * the last page in the current book that
+ * has a slug equal to the one given.
+ * @param $pageSlug
+ * @param $bookSlug
+ * @return null | Page
+ */
+ public function findPageUsingOldSlug($pageSlug, $bookSlug)
+ {
+ $revision = $this->pageRevision->where('slug', '=', $pageSlug)
+ ->where('book_slug', '=', $bookSlug)->orderBy('created_at', 'desc')
+ ->with('page')->first();
+ return $revision !== null ? $revision->page : null;
+ }
+
+ /**
+ * Get a new Page instance from the given input.