From a0bfdf0e5c61c747cbe74d4da8db8442fbfb6dc9 Mon Sep 17 00:00:00 2001
From: James Geiger <james-geiger@users.noreply.github.com>
Date: Tue, 9 Feb 2021 01:27:27 -0600
Subject: [PATCH] Code cleanup, bug squashing

---
 app/Entities/Models/Page.php         | 5 +++--
 app/Entities/Tools/PageContent.php   | 4 ++--
 resources/views/pages/show.blade.php | 3 ---
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/app/Entities/Models/Page.php b/app/Entities/Models/Page.php
index c244219ea..89ed26ea8 100644
--- a/app/Entities/Models/Page.php
+++ b/app/Entities/Models/Page.php
@@ -130,9 +130,10 @@ class Page extends BookChild
     /**
      * Returns URL to a cover image for the page.
      */
-    public function getCoverImage(): string
+    public function getCoverImage()
     {
-        $default = $this->book->getBookCover();
+        //$default = $this->book->getBookCover();
+        $default = url('/logo.png');
 
         $firstImage = (new PageContent($this))->fetchFirstImage();
 
diff --git a/app/Entities/Tools/PageContent.php b/app/Entities/Tools/PageContent.php
index 51562e71f..84506f671 100644
--- a/app/Entities/Tools/PageContent.php
+++ b/app/Entities/Tools/PageContent.php
@@ -362,7 +362,7 @@ class PageContent
     /**
      * Retrieve first image in page content and return the source URL.
      */
-    public function fetchFirstImage(): string
+    public function fetchFirstImage()
     {
         $htmlContent = $this->page->html;
 
@@ -370,6 +370,6 @@ class PageContent
         $dom->loadHTML($htmlContent);
         $images = $dom->getElementsByTagName('img');
 
-        return $images ? $images[0]->getAttribute('src') : null;
+        return $images->length > 0 ? $images[0]->getAttribute('src') : null;
     }
 }
diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.php
index 0810feeb1..35f0d1229 100644
--- a/resources/views/pages/show.blade.php
+++ b/resources/views/pages/show.blade.php
@@ -3,9 +3,6 @@
 @push('social-meta')
     <meta property="og:description" content="{{ Str::limit($page->text, 100, '...') }}">
     <meta property="og:image" content="{{ $page->getCoverImage() }}">
-
-
-    $pageContent->getNavigation($page->html);
 @endpush
 
 @section('body')