]> BookStack Code Mirror - bookstack/blobdiff - app/Uploads/ImageRepo.php
Fixed occurances of altered titles in search results
[bookstack] / app / Uploads / ImageRepo.php
index 67297f3087ee34fb856985cce586435fdee3a3df..494ff3ac0d02c703d06be0a8c58785b3132e0520 100644 (file)
@@ -17,7 +17,8 @@ class ImageRepo
     /**
      * ImageRepo constructor.
      */
-    public function __construct(ImageService $imageService, PermissionService $permissionService) {
+    public function __construct(ImageService $imageService, PermissionService $permissionService)
+    {
         $this->imageService = $imageService;
         $this->restrictionService = $permissionService;
     }
@@ -102,7 +103,7 @@ class ImageRepo
                 if ($filterType === 'page') {
                     $query->where('uploaded_to', '=', $contextPage->id);
                 } elseif ($filterType === 'book') {
-                    $validPageIds = $contextPage->book->pages()->visible()->get(['id'])->pluck('id')->toArray();
+                    $validPageIds = $contextPage->book->pages()->visible()->pluck('id')->toArray();
                     $query->whereIn('uploaded_to', $validPageIds);
                 }
             };
@@ -235,7 +236,7 @@ class ImageRepo
             ->get(['id', 'name', 'slug', 'book_id']);
 
         foreach ($pages as $page) {
-            $page->url = $page->getUrl();
+            $page->setAttribute('url', $page->getUrl());
         }
 
         return $pages->all();