- /**
- * Get a revision by its stored book and page slug values.
- */
- public function getBySlugs(string $bookSlug, string $pageSlug): ?PageRevision
- {
- /** @var ?PageRevision $revision */
- $revision = PageRevision::query()
- ->whereHas('page', function (Builder $query) {
- $query->scopes('visible');
- })
- ->where('slug', '=', $pageSlug)
- ->where('type', '=', 'version')
- ->where('book_slug', '=', $bookSlug)
- ->orderBy('created_at', 'desc')
- ->with('page')
- ->first();
-
- return $revision;
- }
-
- /**
- * Get the latest draft revision, for the given page, belonging to the current user.
- */
- public function getLatestDraftForCurrentUser(Page $page): ?PageRevision
- {
- /** @var ?PageRevision $revision */
- $revision = $this->queryForCurrentUserDraft($page->id)->first();
-
- return $revision;
+ public function __construct(
+ protected PageRevisionQueries $queries,
+ ) {