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
$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);
+ }
}
/**
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)) {