]> _ Git - cubist_cms-back.git/commitdiff
wip #3439 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 27 Feb 2020 18:17:30 +0000 (19:17 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 27 Feb 2020 18:17:30 +0000 (19:17 +0100)
src/app/Magic/Menu/Item.php
src/app/Template/TemplateAbstract.php
src/resources/install/app/Models/Page.php [new file with mode: 0644]

index 69ccc8b3c3913a1312ae4ab51d0ecb06e2f21801..03cd56734ed9563689ebbb7f5ea033bb930a39df 100644 (file)
@@ -9,6 +9,8 @@ use Cubist\Backpack\app\Magic\Models\Locale;
 use Cubist\Backpack\app\Magic\PageData;
 use Cubist\Backpack\app\Template\Navigation;
 use Cubist\Backpack\Facades\App;
+use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Database\QueryException;
 use Illuminate\Support\Str;
 
 class Item
@@ -127,13 +129,19 @@ class Item
         $class = CMSPage::getPageClass();
         /** @var $all CMSPage[] */
         /** @var Eloquent $r */
-        $all = $class::whereVariant($this->getVariant())->orderBy('lft')->get();
+        try {
+            $all = $class::whereVariant($this->getVariant())->orderBy('lft')->get();
+        } catch (QueryException $e) {
+            $all = null;
+        }
 
         $this->setId('#root');
         $this->setRoot($this);
         $this->setBreadcrumbs(false);
         $this->setName($id);
-        $this->setChildrenFromData($all, null);
+        if (null !== $all) {
+            $this->setChildrenFromData($all, null);
+        }
     }
 
     /**
index 21dc7d0a986cc73ce63eda9c2de4fdb6f2df32dc..fe2af6164144ad1afa0cab2d1fd87561748e68f8 100644 (file)
@@ -97,6 +97,9 @@ class TemplateAbstract
             self::$_templates = [];
             $roots = [__DIR__ => 'Cubist\\Backpack\\app\\Template', app_path() . '/Templates' => 'App\\Templates'];
             foreach ($roots as $templates_root => $prefix) {
+                if (!file_exists($templates_root)) {
+                    continue;
+                }
                 $dr = opendir($templates_root);
                 while ($file = readdir($dr)) {
                     if ($file == '.' || $file == '..' || is_dir($templates_root . '/' . $file)) {
diff --git a/src/resources/install/app/Models/Page.php b/src/resources/install/app/Models/Page.php
new file mode 100644 (file)
index 0000000..f2fc9bb
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CMSPage;
+
+class Page extends CMSPage
+{
+
+}