当前位置: 首页>>代码示例>>PHP>>正文


PHP Order::with方法代码示例

本文整理汇总了PHP中app\models\Order::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::with方法的具体用法?PHP Order::with怎么用?PHP Order::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Order的用法示例。


在下文中一共展示了Order::with方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function show($id)
 {
     $user = User::find($id);
     $orders = Order::with('address')->where('user_id', $id)->orderBy('created_at', 'desc')->paginate(config('wyshop.page_size'));
     //        return $orders;
     $order_status = config('wyshop.order_status');
     return view('admin.order.index', ['orders' => $orders, 'order_status' => $order_status]);
 }
开发者ID:q393250152,项目名称:my_shop,代码行数:14,代码来源:UserController.php

示例2: callback

 public function callback(Request $request)
 {
     $order = Order::with('payment')->where('sn', '=', $request->get('sn'))->firstOrFail();
     $response = $order->payment->gateway->complete($order->createPurchaseOrder());
     if ($order->payment->gateway->isSuccessful($response)) {
         $order->pay($order->total_amount);
         return redirect($request->getSession()->pull('payment_callback_redirect'));
     } else {
         throw new \Exception($response->getMessage());
     }
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:11,代码来源:CashierController.php

示例3: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $order = Order::with('address', 'express', 'user', 'order_goods.good')->find($id);
     foreach ($order->order_goods as $k => $v) {
         if (!$v->good) {
             unset($v->good);
             $goods = Good::onlyTrashed()->find($v->good_id);
             $order->order_goods["{$k}"]["good"] = $goods;
         }
     }
     $order_status = config('wyshop.order_status');
     return view('admin.order.edit', ['order' => $order, 'order_status' => $order_status]);
 }
开发者ID:q393250152,项目名称:my_shop,代码行数:19,代码来源:OrderController.php

示例4: update

 public function update(Request $request, $order_id, $id)
 {
     $order = Order::with('products')->findOrFail($order_id);
     if (!$order->canEdit()) {
         throw new \Exception('not_editable');
     }
     $quantity = $request->json()->get('quantity');
     $new_order_products = [];
     $updated_product = null;
     foreach ($order->products as $index => $product) {
         if ($product->id == $id) {
             $product->quantity = $quantity;
             $product->save();
             $updated_product = $product;
         }
         $new_order_products[] = $product;
     }
     if ($updated_product) {
         $order->calc($new_order_products);
         $order->save();
         return response()->updated($updated_product);
     }
     return response()->noContent();
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:24,代码来源:OrderProductController.php

示例5: getFinishedOrders

 /**
  * Get the last 8 finished orders
  *
  * @return array
  */
 public function getFinishedOrders()
 {
     $orders = Order::with('products')->whereNotNull('finished')->take(8)->get();
     return $this->prepareResponse($orders);
 }
开发者ID:FomKiosk,项目名称:API-Laravel,代码行数:10,代码来源:OrderRepository.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $order = \App\Models\Order::with('products')->active()->first();
     view()->share('order', $order);
     return $next($request);
 }
开发者ID:Johca,项目名称:Order-Portal,代码行数:13,代码来源:GetOrderMiddleware.php

示例7: changeStatus

 public function changeStatus($statusId, $orderId, $is_service = 0)
 {
     $response = 0;
     try {
         DB::transaction(function () use($statusId, $orderId, &$response, $is_service) {
             $messageData = [];
             $email = '';
             if ($is_service) {
                 $order = ServiceOrder::with('user', 'service_status')->where('id', $orderId)->first();
                 $messageData['status_was'] = $order->service_status->status;
                 $order->service_status_id = $statusId;
                 $order->save();
                 $response = 1;
                 $email = $order->user->email;
                 $messageData['user'] = $order->user->name;
                 $messageData['type'] = 'прочие услуги';
                 $messageData['order_number'] = $order->id;
                 $messageData['status_now'] = ServiceStatus::find($statusId)->status;
             } else {
                 if ($statusId == Order::CANCELED) {
                     $order = Order::with('products_in_order.price', 'user', 'status')->where('id', $orderId)->first();
                     foreach ($order->products_in_order as $product) {
                         $product->price->amount += $product->product_amount;
                         $product->price->save();
                     }
                     //                    $response = Order::CANCELED;
                 } else {
                     $order = Order::with('user', 'status')->where('id', $orderId)->first();
                     //                    if($statusId == Order::COMPLETED) {
                     //                        $response = Order::COMPLETED;
                     //                    } else {
                     //                        $response = 1;
                     //                    }
                 }
                 $messageData['status_was'] = $order->status->status;
                 $order->status_id = $statusId;
                 $order->save();
                 $response = 1;
                 $email = $order->user->email;
                 $messageData['user'] = $order->user->name;
                 $messageData['type'] = 'запчасти грузовых вагонов';
                 $messageData['order_number'] = $order->id;
                 $messageData['status_now'] = Status::find($statusId)->status;
             }
             Mail::send('emails.statusDone', $messageData, function ($message) use($email) {
                 $message->to($email)->subject('Смена статуса заказа');
             });
         });
     } catch (Exception $e) {
         $response = 0;
     }
     //       dd($response);
     echo $response;
 }
开发者ID:kostik34,项目名称:trains.shop,代码行数:54,代码来源:OrderController.php

示例8: obligation

 public function obligation()
 {
     $obligation = Order::with('order_goods.good')->where('user_id', $this->user->id)->where('status', 0)->get();
     //        $index = array();
     foreach ($obligation as $ob) {
         $sum = 0;
         foreach ($ob->order_goods as $k => $v) {
             $sum += $v->good->price * $v->number;
         }
         $obligation["{$k}"]["xj"] = $sum;
         //            array_push($index,$sum);将得出的小计金额压入数组
     }
     //        return $obligation;
     return view('wechat.obligation', ['obligation' => $obligation]);
 }
开发者ID:q393250152,项目名称:my_shop,代码行数:15,代码来源:IndexController.php

示例9: edit

 public function edit($id)
 {
     $order = Order::with('address', 'express', 'user', 'order_goods.good')->find($id);
     //        return $order;
     return view('admin.order.edit', ['order' => $order]);
 }
开发者ID:beidouzhiguang,项目名称:wy_shop,代码行数:6,代码来源:OrderController.php

示例10: getOrders

 public static function getOrders()
 {
     $orders = Order::with('orderproduct.product')->get();
     //print_r($orders);die();
     return $orders;
 }
开发者ID:prdp,项目名称:LaraTestApp,代码行数:6,代码来源:Order.php

示例11: edit

 public function edit($id)
 {
     $orders = Order::with('address')->where('user_id', $id)->paginate(config('wfhshop.page_size'));
     $order_status = config('wfhshop.order_status');
     return view('admin.order.index', ['orders' => $orders, 'order_status' => $order_status]);
 }
开发者ID:noikiy,项目名称:wfhshop_wechat_laravel,代码行数:6,代码来源:UserController.php

示例12: getmycom

 public function getmycom($id)
 {
     $order = Order::with('order_goods.good', 'comments')->find($id);
     return view('wechat.comment_done', ['order_goods' => $order->order_goods, 'comments' => $order->comments]);
 }
开发者ID:noikiy,项目名称:wfhshop_wechat_laravel,代码行数:5,代码来源:IndexController.php

示例13: getProcessingOrdersForUser

 public function getProcessingOrdersForUser($userId)
 {
     return \App\Models\Order::with('products')->where('user_id', $userId)->where('status', 'processing')->get();
 }
开发者ID:Johca,项目名称:Order-Portal,代码行数:4,代码来源:OrderDBRepository.php

示例14: show

 public function show($id)
 {
     $orders = Order::with('address')->where('status', $id)->orderBy('created_at', 'desc')->paginate(config('wfhshop.page_size'));
     $order_status = config('wfhshop.order_status');
     return view('admin.order.show', ['orders' => $orders, 'id' => $id, 'order_status' => $order_status]);
 }
开发者ID:noikiy,项目名称:wfhshop_wechat_laravel,代码行数:6,代码来源:OrderController.php


注:本文中的app\models\Order::with方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。