App\Http\Controllers\ThemeController::createSetting PHP Method

createSetting() public method

public createSetting ( Request $request, ThemeHandler $themeHandler )
$request Xpressengine\Http\Request
$themeHandler Xpressengine\Theme\ThemeHandler
    public function createSetting(Request $request, ThemeHandler $themeHandler)
    {
        $instanceId = $request->get('theme');
        $title = $request->get('title');
        $theme = $themeHandler->getTheme($instanceId);
        if (!$theme->hasSetting()) {
            throw new NotSupportSettingException();
        }
        $configs = $themeHandler->getThemeConfigList($theme->getId());
        $last = array_pop($configs);
        $lastId = $last->name;
        $prefix = $themeHandler->getConfigId($theme->getId());
        $id = str_replace([$prefix, $themeHandler->configDelimiter], '', $lastId);
        $id = (int) $id + 1;
        $newId = $instanceId . $themeHandler->configDelimiter . $id;
        $themeHandler->setThemeConfig($newId, '_configTitle', $title);
        return redirect()->back()->with('alert', ['type' => 'success', 'message' => '생성되었습니다.']);
    }