/** * Update a resource * * @param mixed $id * @param mixed $data * @return ApiProblem|mixed */ public function update($id, $data) { try { $this->authService->hasRole('admin'); return $this->ordersService->update($id, $data); } catch (\Exception $e) { return new ApiProblem($e->getCode(), $e->getMessage()); } }
/** * Update a resource * * @param mixed $id * @param mixed $data * @return ApiProblem|mixed */ public function update($id, $data) { if (!$this->isOwnerOfOrder($id)) { return new ApiProblem("403", "The user has not access to this info."); } $orderId = $this->service->update($id, $data); if (!$orderId) { return new ApiProblem(500, 'Erro ao salvar ordem. '); } return ['orderId' => $orderId]; }
public function update($id, $data) { return $this->service->update($id, $data); }