/** * Create a sub-category * * @param int $id * @return Response */ public function subStore($id) { $validator = $this->validateId($id); if ($validator->fails()) { return $this->respondInsufficientPrivileges($validator->messages()->all()); } $category = Category::find($id); if (!$category) { return $this->respondNotFound('forum.category-not-found'); } $newCategory = new Category(Input::all()); if ($category->categories()->save($newCategory)) { return $this->respond($this->collectionTransformer->transformCategory($newCategory)); } return $this->respondServerError(); }