Пример #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param TemplateRequest $request
  * @param Template        $template
  *
  * @return \Illuminate\Http\Response
  */
 public function update(TemplateRequest $request, Template $template)
 {
     $template->skeleton = $request->get('skeleton');
     $template->title = $request->get('title');
     event(new TemplateWillBeUpdated($template));
     $template->save();
     TemplateHelper::saveTemplateBlocks($template);
     TemplateSkeleton::generateTemplateFile($template);
     event(new TemplateWasUpdated($template));
     return redirect()->route('zxadmin.template.edit', $template->id);
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     TemplateHelper::saveTemplates('Default');
 }
Пример #3
0
 /**
  * set a new active Theme.
  *
  * @param string $theme
  *
  * @return bool
  */
 public function setActive($theme)
 {
     if (!$this->exists($theme)) {
         throw new Exception("Theme {$theme} doesn't exist!");
     }
     umask(0);
     $this->cleanActiveTheme();
     $themePath = base_path('themes' . DIRECTORY_SEPARATOR . $theme);
     @symlink($themePath . '/task.js', base_path('tasks/frontend.js'));
     @symlink($themePath . '/widgets', base_path('widgets/Frontend/Theme'));
     env_replace('APP_FRONTEND_THEME', $theme);
     $this->saveThemePartials();
     if (Template::all()->isEmpty()) {
         TemplateHelper::saveTemplates($theme);
     }
     Artisan::call('theme:publish', ['--force' => true]);
 }