/** * Find a category by id. * * @param $categoryId * @throws CategoryNotFoundException * @return mixed */ public function find($categoryId) { $category = $this->categoryRepo->find($categoryId); if (is_null($category)) { $error = 'Category Not Found'; throw new CategoryNotFoundException($error); } return $category; }