/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $deliverymanId = Authorizer::getResourceOwnerId(); // ISSO ------------ // $order = $this->orderRepository->with(['items', 'coupon'])->find($id); // $order->items->each(function($item) { // $item->product; // }); // OU ISSO ------------ $order = $this->orderRepository->skipPresenter(false)->getByIdAndDeliveryman($id, $deliverymanId); return $order; }
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; }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { /* tudo retirado após o transformer e presenter // ISSO ------------ // $order = $this->orderRepository->with(['items', 'coupon'])->find($id); // $order->items->each(function($item) { // $item->product; // }); // OU ISSO ------------ $order = $this->orderRepository->with(['items.product.category', 'coupon'])->find($id); */ return $this->orderRepository->skipPresenter(false)->with($this->with)->find($id); return $order; }
public function show($id) { $id_deliveryman = Authorizer::getResourceOwnerId(); return $this->orderRepository->skipPresenter(false)->getByIdAndDeliveryman($id, $id_deliveryman); }
public function show($id) { //['client','items.product','cupom','deliveryman'] $idUser = Authorizer::getResourceOwnerId(); return $this->orderRepository->skipPresenter(false)->with($this->whith)->findWhere(['client_id' => $idUser, 'id' => $id]); }