Create a new category item
public createItem ( |
||
$category | category instance | |
$inputs | array | item attributes for created |
리턴 |
public function storeItem(CategoryHandler $handler, $categoryId) { $category = $handler->get($categoryId); $inputs = Input::except('_token'); $parent = null; if (isset($inputs['parentId'])) { if (empty($inputs['parentId']) === false) { $parent = $handler->getItem($inputs['parentId']); } unset($inputs['parentId']); } DB::beginTransaction(); try { $item = $handler->createItem($category, $inputs, $parent); } catch (Exception $e) { DB::rollBack(); throw $e; } DB::commit(); return Presenter::makeApi($item->toArray()); }