- $recents = $this->isSignedIn() ? Views::getUserRecentlyViewed(12*$recentFactor, 0) : $this->entityRepo->getRecentlyCreated('book', 12*$recentFactor);
- $recentlyUpdatedPages = $this->entityRepo->getRecentlyUpdated('page', 12);
+ $recents = $this->isSignedIn() ?
+ (new RecentlyViewed())->run(12 * $recentFactor, 1)
+ : Book::visible()->orderBy('created_at', 'desc')->take(12 * $recentFactor)->get();
+ $favourites = (new TopFavourites())->run(6);
+ $recentlyUpdatedPages = Page::visible()->with('book')
+ ->where('draft', false)
+ ->orderBy('updated_at', 'desc')
+ ->take($favourites->count() > 0 ? 5 : 10)
+ ->select(Page::$listAttributes)
+ ->get();