Components\ThemeManager\Services\ThemeInstaller::installTheme PHP Метод

installTheme() публичный Метод

public installTheme ( )
    public function installTheme()
    {
        try {
            $this->full_path = $this->extractToTemporary();
            $success = $this->getAndCheckConfig();
            $this->copyFiles();
            $this->copyScreenshot();
            $theme = Theme::create(array('name' => $this->config['name'], 'version' => $this->config['version'], 'author' => $this->config['author'], 'description' => $this->config['description'], 'directory' => $this->config['directory'], 'screenshot' => $this->screenshot, 'target' => $this->target, 'has_settings' => $this->has_settings));
            $this->installModules();
            if ($this->install_sample_data) {
                $this->installSampleData($theme);
            }
            $this->cleanup();
            return $this->listener->installerSucceeds('backend/theme-manager', 'The theme was installed successfully');
        } catch (Exception $e) {
            return $this->listener->installerFails($e->getMessage());
        }
    }

Usage Example

Пример #1
0
 /**
  * Store a newly created theme in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     if (!isset($input['file'])) {
         return Redirect::back()->with('error_message', trans('error_messages.theme_file_select'));
     }
     $theme_installer = new ThemeInstaller($this, $input);
     return $theme_installer->installTheme();
 }