]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6011 @.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Sep 2023 08:23:53 +0000 (10:23 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 25 Sep 2023 08:23:53 +0000 (10:23 +0200)
app/Http/Controllers/Admin/Operations/FluidbookCollection/PreviewOperation.php

index 12f95a1d5092cc8d83cc4cca914996e5497b1cab..15247de26d5baabbede063e138151772c1c537c1 100644 (file)
@@ -99,15 +99,17 @@ trait PreviewOperation
      */
     protected static function _getCollectionAndTheme($id, $hash, &$collection, &$theme)
     {
-        $collection = FluidbookCollection::find($id)->where('hash', $hash)->first();
+        $collection = FluidbookCollection::withoutGlobalScopes()->where('id', $id)->where('hash', $hash)->first();
         if (null === $collection) {
             abort(404);
         }
         foreach ($collection->publications as $pub) {
-            $firstFluidbookId = $pub['fluidbook'];
+            $fluidbook = FluidbookPublication::withoutGlobalScopes()->find( $pub['fluidbook']);
+            if (null === $fluidbook) {
+                continue;
+            }
             break;
         }
-        $fluidbook = FluidbookPublication::find($firstFluidbookId);
         if (!isset($theme)) {
             $theme = $fluidbook->getTheme();
         }