public function updateStatus($id, $deliverymanId, $status) { // para retornar o objeto a ser atualizado $order = $this->orderRepository->getByIdAndDeliveryman($id, $deliverymanId); if ($order instanceof Order) { $order->status = $status; $order->save(); // para retornar o modelo do presenter do objeto para o client $order = $this->orderRepository->skipPresenter(false)->getByIdAndDeliveryman($id, $deliverymanId); return $order; } return false; }
public function updateStatus($id, $deliveryman, $status) { $order = $this->orderRepository->getByIdAndDeliveryman($id, $deliveryman)->first(); if ($order) { $order->status = $status; $order->save(); return $order; } abort(400, 'Order not fund'); }