src/Extensions/ThemeManager.php
public function activateTheme($themeId)
    {
        // Reset to stable base.
        $this->untheme();

        // If default theme is set, we're done.
        if ($themeId == 'default') {
            return true;
        }

        // Current Theme
        $currentTheme = $this->getTheme($currentThemeId = $this->getActive());
        // Chosen Theme
        $theme = $this->getTheme($themeId);
        // If new theme is aleady active we can skip the DB update.
        if ($currentTheme->getId() != $themeId) {
            Settings::updateOrCreate(['setting_name' => self::ACTIVE_KEY], ['setting_value' => $themeId]);
        }

        // Merge assets
        $publicPublished = $this->publishThemePublic($theme);
        // Clear views and publish theme views
        $viewsPublished = $this->publishThemeViews($theme);
        // If theme parts weren't successfully published return false;
        if (! $publicPublished && $viewsPublished) {
            // Reset to stable unthemed.
            $this->unTheme();

            return false;
        }

        return true;
    }
public function activateTheme($themeId)
    {
        // Reset to stable base.
        $this->untheme();

        // If default theme is set, we're done.
        if ($themeId == 'default') {
            return true;
        }

        // Current Theme
        $currentTheme = $this->getTheme($currentThemeId = $this->getActive());
        // Chosen Theme
        $theme = $this->getTheme($themeId);
        // If new theme is aleady active we can skip the DB update.
        if ($currentTheme->getId() != $themeId) {
            Settings::updateOrCreate(['setting_name' => self::ACTIVE_KEY], ['setting_value' => $themeId]);
        }

        // Merge assets
        $publicPublished = $this->publishThemePublic($theme);
        // Clear views and publish theme views
        $viewsPublished = $this->publishThemeViews($theme);
        // If theme parts weren't successfully published return false;
        if (! $publicPublished && $viewsPublished) {
            // Reset to stable unthemed.
            $this->unTheme();

            return false;
        }

        return true;
    }
Assert/change active theme.

@param array $enabled
@return bool