Publish theme.

@param mixed $theme
425980
protected function publish($theme)
    {
        $theme = $theme instanceof Theme ? $theme : $this->laravel['themes']->find($theme);

        if (!is_null($theme)) {
            $assetsPath = $theme->getPath('assets');

            $destinationPath = public_path('themes/'.$theme->getLowerName());

            $this->laravel['files']->copyDirectory($assetsPath, $destinationPath);

            $this->line("Asset published from: <info>{$theme->getName()}</info>");
        }
    }
696836
public function setTheme($theme)
    {
        if (!self::isValidTheme($theme)) {
            throw new Exception(
                'Theme ' . $theme . ' is not valid. Please use one of [' . join(', ', self::$themes) . ']'
            );
        }

        $this->theme = $theme;
    }
926347
public function add(Theme $theme)
    {
        if ($this->exists($theme->name)) {
            throw new Exceptions\themeAlreadyExists($theme);
        }
        $this->themes[] = $theme;
        return $theme;
    }
62859
public function hasTheme($theme)
    {
        if (is_dir($this->getThemesDir() . $theme)) {
            return true;
        } else {
            foreach (modules() as $module) {
                if (in_array($module->getType(), ['KERNEL', 'FRAMEWORK'])) {
                    continue;
                } elseif (is_dir($module->getResourcesDir('themes') . $theme)) {
                    return true;
                }
            }
        }

        return false;
    }
1115904
public function setTheme(string $theme): FieldTypeInterface
    {
        $this->options['theme'] = $theme;

        // Update all attached fields with the given theme.
        foreach ($this->repository->all() as $field) {
            /** @var FieldTypeInterface $field */
            $field->setTheme($theme);
        }

        // Update all attached groups with the given theme.
        foreach ($this->repository()->getGroups() as $group) {
            /** @var SectionInterface $group */
            $group->setTheme($theme);
        }

        return $this;
    }
153753
public function theme($theme = null)
    {
        deprecationWarning(
            'View::theme() is deprecated. ' .
            'Use getTheme()/setTheme() instead.'
        );

        if ($theme === null) {
            return $this->theme;
        }

        $this->theme = $theme;
    }
1314282
protected function getThemes(?string $theme)
    {
        if ($theme === null || $theme === 'all') {
            return $this->themes->all();
        }

        try {
            return $this->themes->get($theme, false);
        } catch (\InvalidArgumentException $e) {
            throw new \InvalidArgumentException('Theme ' . $theme . ' not found');
        }
    }
723581
private function publish($template)
    {
        if (! file_exists(app_path('Http' . DIRECTORY_SEPARATOR . 'Controllers' . DIRECTORY_SEPARATOR . 'Admin'))) {
            mkdir(app_path('Http' . DIRECTORY_SEPARATOR . 'Controllers' . DIRECTORY_SEPARATOR . 'Admin'));
            chmod(app_path('Http' . DIRECTORY_SEPARATOR . 'Controllers' . DIRECTORY_SEPARATOR . 'Admin'), 0777);
        }
        file_put_contents(app_path('Http' . DIRECTORY_SEPARATOR . 'Controllers' . DIRECTORY_SEPARATOR . 'Admin' . DIRECTORY_SEPARATOR . $this->fileName),
            $template);
    }
594181
public function publish($component)
    {
        with(new SeedPublisher(new Seeder($component)))
            ->setRepository($this->laravel['components'])
            ->setConsole($this)
            ->publish();
    }
760733
public function reload_theme() {
        if (!is_null($this->_theme)) {
            $this->_theme = theme_config::load($this->_theme->name);
        }
    }
1074043
protected function set_theme($theme = null, $type = 'active')
	{
		// set the theme if given
		if ($theme !== null)
		{
			// remove the defined theme asset paths from the asset instance
			empty($this->active['asset_path']) or $this->asset->remove_path($this->active['asset_path']);
			empty($this->fallback['asset_path']) or $this->asset->remove_path($this->fallback['asset_path']);

			$this->{$type} = $this->create_theme_array($theme);

			// add the asset paths to the asset instance
			empty($this->fallback['asset_path']) or $this->asset->add_path($this->fallback['asset_path']);
			empty($this->active['asset_path']) or $this->asset->add_path($this->active['asset_path']);
		}

		// and return the theme config
		return $this->{$type};
	}
623626
public function theme_should_be_activated( $theme )
	{
		$theme = $this->replace_variables( $theme );
		$current_theme = $this->get_current_theme();

		if ( $theme !== $current_theme ) {
			throw new \Exception( sprintf(
				"The current theme is %s, but it should be %s",
				$current_theme,
				$theme
			) );
		}
	}
251971
public function findOrFail($theme, $type = 'frontend')
    {
        if (in_array($type . '.' . $theme, array_keys($this->themes))) {
            return $this->themes[$type . '.' . $theme];
        }

        throw new ThemeNotFoundException('Theme not found!');
    }
475611
public function getThemeConfig($theme)
    {
        $themesConfig = $this->getThemesConfig();

        if (!empty($themesConfig[$theme])) {
            return $themesConfig[$theme];
        } elseif (!empty($themesConfig['generic'])) {
            return $themesConfig['generic'];
        }

        throw new RuntimeException(
            'No theme config found for ' . $theme
            . ' and no default theme found'
        );
    }
1105929
protected function publishAssets(string $package): void
    {
        if (! is_null($path = $this->getPath())) {
            $this->assets->publish($package, $path);
        } else {
            $this->assets->publishPackage($package);
        }

        $this->output->writeln('<info>Assets published for package:</info> '.$package);
    }
448202
public function theme($theme = null)
    {
        deprecationWarning(
            'Email::theme() is deprecated. Use $email->viewBuilder()->getTheme()/setTheme() instead.'
        );

        if ($theme === null) {
            return $this->getTheme();
        }

        return $this->setTheme($theme);
    }
1280567
protected function secondaryTheme($theme=null) {
        
        if($theme) {
            $this->origin = $this->container->getThemeActivated();
            $this->container->setThemeActivated($theme);
        }
        
    }