/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { #find user $order = Order::findOrFail($id); #skin to call $view = 'skins.skin_b.order.show'; #call the view with the user return view($view, ['order' => $order]); }
public function orderPosted(Request $request) { $order_id = $request->input('order_id'); $post_no = $request->input('post_no'); $order = Order::findOrFail($order_id); if ($order->order_status_id != 2) { return response()->json(['success' => false]); } $order->update(['post_no' => $post_no, 'order_status_id' => 3]); return response()->json(['success' => true]); }
public function store(Request $request, $order_id) { $order = Order::findOrFail($order_id); if (!$order->canEdit()) { throw new \Exception('not_editable'); } $sku = $request->json()->get('sku'); $quantity = $request->json()->get('quantity'); $stock = ProductStock::with('product')->where('sku', '=', $sku)->firstOrFail(); $order_product = $stock->pick($quantity); $new_product = response()->created($order->products()->save($order_product)); $order->calc($order->products()->get()); $order->save(); return $new_product; }
public function show($id) { $data = ['order' => Order::findOrFail($id), 'products' => Product::lists('name', 'id')]; return view('order.edit', $data); }
public function complete(Request $request, $id) { $order = Order::findOrFail($id); \DB::transaction(function () use($id, $request, $order) { $order->complete()->logs()->save(new OrderLog(['do' => 'complete', 'name' => $request->user->name, 'comment' => $request->json()->get('comment', '')])); }); return response()->updated($order); }
/** * Display the specified resource. * * @param int $id * * @return Response */ public function show($id) { $order = Order::findOrFail($id); return view('frontoffice.orders.show', compact('order')); }