예제 #1
0
 public function edit($id, OrderService $orderService)
 {
     $order = $this->orderRepository->find($id);
     $statusList = $orderService->statusList();
     $deliverers = $orderService->deliverersList();
     return view('delivery.orders.edit', compact('order', 'statusList', 'deliverers'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $deliverymanId = Authorizer::getResourceOwnerId();
     if ($order = $this->orderService->updateStatus($id, $deliverymanId, $request->get('status'))) {
         return $order;
     }
     abort(400, 'Pedido não encontrado');
 }
예제 #3
0
 public function store(CheckoutRequest $request)
 {
     $data = $request->all();
     $clientId = $this->userRepository->find(Auth::user()->id)->client->id;
     $data['client_id'] = $clientId;
     $this->orderService->create($data);
     return redirect()->route('customer.order.index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CheckoutRequest $request)
 {
     $data = $request->all();
     $id = Authorizer::getResourceOwnerId();
     $clientId = $this->userRepository->find($id)->client->id;
     $data['client_id'] = $clientId;
     $order = $this->orderService->create($data);
     return $this->orderRepository->skipPresenter(false)->with($this->with)->find($order->id);
 }
 public function updateStatus(Request $request, $id)
 {
     $id_deliveryman = Authorizer::getResourceOwnerId();
     $order = $this->orderService->updateStatus($id, $id_deliveryman, $request->get('status'));
     if ($order) {
         return $this->orderRepository->find($order->id);
     }
     abort(400, 'Order não encontrada');
 }