Exemplo n.º 1
0
 /**
  * Display list of parent categories
  *
  * @param  int $id
  * @return Response
  */
 public function sub($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');
     }
     $categories = $category->categories;
     if (!$categories->count()) {
         return $this->respond(array());
     } else {
         return $this->respond($this->collectionTransformer->transformCategories($categories));
     }
     return $this->respondServerError();
 }