/** * Create a resource * * @param mixed $data * @return ApiProblem|mixed */ public function create($data) { $userRepository = $this->repository->getUsersRepository(); $user = $userRepository->findByUsername($this->getIdentity()->getRoleId()); if ($user->getRole() == "admin") { return $this->repository->create($data); } return new ApiProblem(403, 'Sem autorização para criar'); }
/** * Create a resource * * @param mixed $data * @return ApiProblem|mixed */ public function create($data) { return $this->repository->create($data); //return new ApiProblem(405, 'The POST method has not been defined'); }