/** * @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); } } }