info("Check Theme: ".$theme); if(substr($theme, 0, 1) == ".") { continue; } $settings = json_decode(file_get_contents(__DIR__."/../../../resources/views/themes/tenant/".$theme."/settings.json")); $themeModel = Theme::query()->where("name", "=", $theme)->where("typ", "=", "tenant")->first(); if(!is_null($themeModel)) { $this->info("Themes already exists: ".$theme); continue; } $this->info("Found new Theme: ".$theme); $themeModel = new Theme(); $themeModel->typ = "tenant"; $themeModel->name = $theme; $themeModel->status = "private"; if($settings->public) { $themeModel->status = "public"; } $themeModel->img_pixel = $settings->usesSize->pixel; $themeModel->img_small = $settings->usesSize->small; $themeModel->img_medium = $settings->usesSize->medium; $themeModel->img_big = $settings->usesSize->big; $themeModel->saveOrFail(); } $themesGallery = scandir(__DIR__."/../../../resources/views/themes/gallery"); foreach ($themesGallery as $theme) { $this->info("Check Theme: ".$theme); if(substr($theme, 0, 1) == ".") { continue; } $settings = json_decode(file_get_contents(__DIR__."/../../../resources/views/themes/gallery/".$theme."/settings.json")); $themeModel = Theme::query()->where("name", "=", $theme)->where("typ", "=", "gallery")->first(); if(!is_null($themeModel)) { $this->info("Themes already exists: ".$theme); continue; } $this->info("Found new Theme: ".$theme); $themeModel = new Theme(); $themeModel->typ = "gallery"; $themeModel->name = $theme; $themeModel->status = "private"; if($settings->public) { $themeModel->status = "public"; } $themeModel->img_pixel = $settings->usesSize->pixel; $themeModel->img_small = $settings->usesSize->small; $themeModel->img_medium = $settings->usesSize->medium; $themeModel->img_big = $settings->usesSize->big; $themeModel->saveOrFail(); } } }