public function storeCategory(CategoryHandler $categoryHandler, Request $request)
 {
     $boardId = $request->get('boardId');
     $input = ['name' => $boardId . '-' . BoardModule::getId()];
     $category = $categoryHandler->create($input);
     if ($boardId == '') {
         // global config
         $config = $this->configHandler->getDefault();
         $config->set('categoryId', $category->id);
         $this->configHandler->putDefault($config->getPureAll());
     } else {
         $config = $this->configHandler->get($boardId);
         $config->set('categoryId', $category->id);
         $this->instanceManager->updateConfig($config->getPureAll());
     }
     return XePresenter::makeApi($category->getAttributes());
 }
 /**
  * update
  *
  * @param string $boardId board id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($boardId)
 {
     $config = $this->configHandler->get($boardId);
     $permissionNames = [];
     $permissionNames['read'] = ['readMode', 'readRating', 'readUser', 'readExcept'];
     $permissionNames['list'] = ['listMode', 'listRating', 'listUser', 'listExcept'];
     $permissionNames['create'] = ['createMode', 'createRating', 'createUser', 'createExcept'];
     $permissionNames['manage'] = ['manageMode', 'manageRating', 'manageUser', 'manageExcept'];
     $inputs = Input::except(array_merge(['_token'], $permissionNames['read'], $permissionNames['list'], $permissionNames['create'], $permissionNames['manage']));
     //$inputs['extensions'] = isset($inputs['extensions']) ? $inputs['extensions'] : [];
     foreach ($inputs as $key => $value) {
         $config->set($key, $value);
     }
     $config = $this->instanceManager->updateConfig($config->getPureAll());
     // 확장 기능 사용
     //$this->extensionHandler->activate($inputs['extensions'], $config);
     // permission update
     $grant = new Grant();
     foreach ($this->permissionHandler->getActions() as $action) {
         $permInputs = Input::only($permissionNames[$action]);
         if ($permInputs[$action . 'Mode'] == 'manual') {
             $grant = $this->permissionHandler->createGrant($grant, $action, [Grant::RATING_TYPE => $permInputs[$action . 'Rating'], Grant::GROUP_TYPE => isset($permInputs[$action . 'Group']) ? $permInputs[$action . 'Group'] : [], Grant::USER_TYPE => explode(',', $permInputs[$action . 'User']), Grant::EXCEPT_TYPE => explode(',', $permInputs[$action . 'Except'])]);
         }
     }
     $this->permissionHandler->set($boardId, $grant);
     return Redirect::to($this->urlHandler->managerUrl('edit', ['boardId' => $boardId]));
 }