Пример #1
0
 /**
  * @param Theme $theme
  * @throws Exception
  */
 protected function settings(Theme $theme)
 {
     foreach ($this->settings as $setting) {
         $type = $this->settingGetType($setting);
         $setting['type_id'] = $type->id;
         unset($setting['type']);
         $setting = $theme->settings()->create($setting);
         $method = 'settingsHandle' . ucfirst($type->name);
         if (method_exists($this, $method)) {
             call_user_func([$this, $method], $setting);
         }
     }
 }
Пример #2
0
 public function up()
 {
     $theme = Theme::where('name', $this->name)->where('version', $this->version)->first();
     if (!$theme) {
         throw new Exception('Invalid theme provided');
     }
     $this->settings($theme);
 }
Пример #3
0
 /**
  * @param Theme $theme
  * @return static
  */
 protected function createSelection(Theme $theme)
 {
     if ($this->account->account()) {
         $selector = $this->selector->create(['theme_id' => $theme->getKey(), 'account_id' => $this->account->account()->getKey(), 'active' => true]);
         $this->addDefaults($theme, $selector);
         return $selector;
     }
 }
 /**
  * Reverse the migrations.
  */
 public function down()
 {
     $theme = Theme::where('name', $this->name)->delete();
 }