/** * create product * * @param Request request * @return Response */ public function createTag(TagRequest $request) { $tag = new Tag(); return $tag->createItem($request->all()); }
/** * create product * * @param Request request * @return Response */ public function createTag(TagRequest $request) { $tag = new Tag(); $re = $tag->createItem($request->all()); $re['childs'] = $re->countChild(); if ($re->parent_id != 0) { $parent = Tag::find($re->parent_id); $re['childs_of_parent'] = $parent->countChild(); } else { $re['childs_of_parent'] = 0; } echo json_encode($re); }