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


PHP Order::find方法代码示例

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


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

示例1: changeStatus

 public function changeStatus(Request $request, Order $order, Product $product, $id)
 {
     $input = $request->order_status;
     if ($input == 4) {
         $content = $order->find($id)->content;
         foreach ($content as $item) {
             $product->restIncrement($item->product_id, $item->quantity);
         }
     }
     $order->changeStatus($id, $input);
     $status = $order->find($id)->status->title;
     return redirect()->back()->with('message', "Статус заказа изменен на '{$status}'");
 }
开发者ID:DimaPikash,项目名称:eshop,代码行数:13,代码来源:OrderController.php

示例2: cancel

 /**
  *	Updates database to cancel client order
  */
 public function cancel($id)
 {
     $order = Order::find($id);
     $order->status = 'Canceled';
     $order->save();
     return redirect('/user/dashboard/orders_history');
 }
开发者ID:2dan-devs,项目名称:williamnavasphoto,代码行数:10,代码来源:ClientOrdersController.php

示例3: paid

 protected function paid($orderId, $chargeId)
 {
     $completedOrder = Order::find($orderId);
     $completedOrder->paid = 'paid';
     $completedOrder->charge_id = $chargeId;
     $completedOrder->save();
 }
开发者ID:robboyland,项目名称:ecom,代码行数:7,代码来源:OrderProcessor.php

示例4: download

 /**
  *	Recieves an ajax request to download an order
  */
 public function download(Request $request)
 {
     $order = Order::find($request->orderID);
     // create new zip opbject
     $zip = new \ZipArchive();
     // create a temp file & open it
     $tmp_file = tempnam('.zip', '');
     $file_name = $tmp_file;
     $zip->open($tmp_file, \ZipArchive::CREATE);
     if (strcmp($order->type, 'Album Order') == 0) {
         $selections = $order->albumSelections;
         $i = 1;
         //loop through all files
         foreach ($selections as $selection) {
             //add file to the zip
             $zip->addFile(public_path($selection->photo->photo_path_high_res), $i . '.jpg');
             $i++;
         }
     } else {
         $selections = $order->printsSelections;
         $i = 1;
         //loop through all files
         foreach ($selections as $selection) {
             //add file to the zip
             $zip->addFile(public_path($selection->photo->photo_path_high_res), $i . ' ' . $selection->format->format . ' ' . $selection->quantity . '.jpg');
             $i++;
         }
     }
     // close zip
     $zip->close();
     //send the file to the browser as a download
     return response()->download($tmp_file, 'orders.zip')->deleteFileAfterSend(true);
 }
开发者ID:2dan-devs,项目名称:williamnavasphoto,代码行数:36,代码来源:AdminOrderController.php

示例5: mergeOrders

 /**
  * Merge the orders of a guest with an existing user order
  * @param  [type] $orderID   [description]
  * @param  [type] $sessionID [description]
  * @return bool
  */
 public function mergeOrders($orderID, $sessionID, $request)
 {
     $sessionOrder = Order::findOrFail($sessionID);
     $sessionOrderLines = $sessionOrder->orderlines()->get();
     $userOrder = Order::find($orderID);
     $userOrderLines = $userOrder->orderlines()->get();
     if (count($sessionOrderLines)) {
         foreach ($sessionOrderLines as $sessionOrderLine) {
             if (count($userOrderLines)) {
                 foreach ($userOrderLines as $userOrderLine) {
                     if ($userOrderLine->product_id == $sessionOrderLine->product_id) {
                         $userOrderLine->amount = $sessionOrderLine->amount;
                         $userOrderLine->save();
                         $sessionOrderLine->delete();
                     } else {
                         $sessionOrderLine->order_id = $orderID;
                         $sessionOrderLine->save();
                     }
                 }
             }
             $sessionOrderLine->order_id = $orderID;
             $sessionOrderLine->save();
         }
     }
     $guest = User::find($request->session()->get('user_id'));
     $guest->delete();
     $sessionOrder->delete();
     $request->session()->put('order_id', $orderID);
     $request->session()->forget('user_id');
     return true;
 }
开发者ID:sanderdekroon,项目名称:yourfoodbox,代码行数:37,代码来源:VerifyOrder.php

示例6: save

 public function save(array $options = array())
 {
     $saved = parent::save($options);
     if ($saved) {
         $data = [];
         if (is_array($this->original)) {
             $data = $data + $this->original;
         }
         if (is_array($this->attribute)) {
             $data = $data + $this->attribute;
         }
         $data = $data + $options;
         #here we validate the type and return the source reference
         switch (ActionType::find($data['action_type_id'])->source_type) {
             case 'order':
                 $action = 3;
                 $order = Order::find($data['source_id']);
                 if ($order) {
                     $users = [$order->user_id, $order->seller_id];
                 }
                 break;
         }
         if (isset($users)) {
             Notice::create(['action_type_id' => $action, 'sender_id' => $data['user_id'], 'user_ids' => $users, 'source_id' => $data['source_id']]);
         }
     }
 }
开发者ID:masterpowers,项目名称:antVel,代码行数:27,代码来源:Comment.php

示例7: makeOrder

 public function makeOrder(Request $request)
 {
     $validator = $this->validator($request->all());
     if (!isset(\Auth::user()->name)) {
         if ($validator->fails()) {
             return redirect('order/save')->withErrors($validator)->withInput();
         }
     }
     $input = $request->all();
     $cartCollection = Cart::getContent();
     $products = $cartCollection->toArray();
     $productId = array_keys($products);
     if (isset(\Auth::user()->name)) {
         $authUser = \Auth::user();
         $orderSave = Order::create(['telephone' => $authUser->telephone, 'user_name' => $authUser->name, 'email' => $authUser->email, 'adress' => $authUser->adress, 'town' => $authUser->town, 'comment' => $input['comment']]);
     } else {
         $orderSave = Order::create(['telephone' => $input['telephone'], 'user_name' => $input['name'], 'email' => $input['email'], 'adress' => $input['adress'], 'town' => $input['town'], 'comment' => $input['comment']]);
     }
     $order = Order::find($orderSave->id);
     $order->product()->attach($productId);
     foreach ($productId as $rm) {
         Cart::remove($rm);
     }
     return redirect(LaravelLocalization::setLocale() . "/")->with('msg', 'Направихте успешна поръчка. Ще се свържем скоро.');
 }
开发者ID:sbrojdenov,项目名称:shop,代码行数:25,代码来源:faadb50f4c15f8d00822fb92de64666caacb98fe.php.php

示例8: edit

 public function edit($id)
 {
     $orders = Order::find($id);
     $orders->viewed = 1;
     $orders->save();
     $products = $orders->product->toArray();
     return view('admin.orders.edit', compact('orders', 'products'));
 }
开发者ID:sbrojdenov,项目名称:shop,代码行数:8,代码来源:OrdersController.php

示例9: payment

 public function payment(Request $request)
 {
     $id = $request->get("id", 0);
     $order = Order::find($id);
     if (!$order) {
         return "";
     }
     return view("admin.orders.payment")->with('order', $order);
 }
开发者ID:zangee3,项目名称:avs,代码行数:9,代码来源:OrdersController.php

示例10: paysuccess

 public function paysuccess(Request $request)
 {
     $order = $order = Order::find($request->get('oid'));
     if (empty($order)) {
         return $this->failure_noexists();
     }
     $this->_order = $order;
     return $this->view('m.paysuccess');
 }
开发者ID:unionbt,项目名称:hanpaimall,代码行数:9,代码来源:PayController.php

示例11: changeStatus

 public function changeStatus(ChangeStatusOrderRequest $request)
 {
     $idOrder = $request->input('id');
     //get current status
     $currentStatus = Order::find($idOrder)->status;
     $newStatus = $request->input('status');
     if ($currentStatus == $this::CANCEL) {
         return redirect_errors('Order canceled cannot changer status!');
     }
     if ($currentStatus == $this::PENDING && $newStatus > $this::DELIVERING) {
         return redirect_errors('Order is Pending can only changer Cancel or Delivering status!');
     }
     if ($currentStatus == $this::DELIVERING && $newStatus > $this::DELIVERED && $newStatus < $this::DELIVERING && $newStatus != $this::CANCEL) {
         return redirect_errors('Order is Delivering can only changer Cancel or Delivered status!');
     }
     if ($currentStatus == $this::DELIVERED && $newStatus < $this::DELIVERED && $newStatus != $this::CANCEL) {
         return redirect_errors('Order is Delivered can only changer Cancel or Charged status!');
     }
     if ($currentStatus == $this::CHARGED) {
         return redirect_errors('Order charged cannot changer status!');
     }
     $model = new Order();
     DB::beginTransaction();
     try {
         $order = $model->find(intval($idOrder));
         $order->status = intval($newStatus);
         $order->save();
         //if cancel then qty return
         if ($newStatus == $this::CANCEL) {
             $model = new Order();
             $order = $model->viewOrder($idOrder);
             $details = $order['order']['detail'];
             foreach ($details as $detail) {
                 $qtyReturn = $detail['quantity'];
                 $currentQty = Cd::find($detail['product_id'])->quantity;
                 $currentBuyTime = Cd::find($detail['product_id'])->buy_time;
                 Cd::find($detail['product_id'])->update(['quantity' => $currentQty + $qtyReturn, 'buy_time' => $currentBuyTime + $qtyReturn]);
             }
             //                $customer=User::find('user_id');
             //                if(is_null($customer)){
             //
             //                }
             //                Mail::send('auth.message_order', ['name' => 'you'],
             //                    function ($message) use ($data) {
             //                        $message
             //                            ->to($data['email'], $data['name'])
             //                            ->from('info@otherdomain.com')
             //                            ->subject('Your order canceled!');
             //                    });
         }
         DB::commit();
         return redirect()->back()->with('success', 'Updated status');
     } catch (\Exception $e) {
         DB::rollback();
         return redirect_errors('Updated Fails!');
     }
 }
开发者ID:hungnt167,项目名称:CDShop,代码行数:57,代码来源:OrderController.php

示例12: showOrder

 public function showOrder($order_id)
 {
     $order = Order::find($order_id);
     if ($order) {
         $order->items = unserialize($order->items);
         return view('order.details', ['order' => $order]);
     } else {
         return ['status' => '404', 'message' => 'Order not found'];
     }
 }
开发者ID:labs7in0,项目名称:E-cash,代码行数:10,代码来源:OrderController.php

示例13: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $order = Order::find($id);
     $order_detail = Order_detail::where('order_id', $id)->get();
     $product = Product::all();
     $color = Color::all();
     $size = Size::all();
     return view('backend.pages.order.detail', array('order' => $order, 'detail' => $order_detail, 'product' => $product, 'color' => $color, 'size' => $size));
 }
开发者ID:nhunght,项目名称:mork_SmartOSC,代码行数:16,代码来源:OrderController.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (Auth::check()) {
         $order = \App\Order::find($request->order);
         if ($order->id_user == Auth::user()->id) {
             return $next($request);
         } else {
             return view('errors.404');
         }
     }
 }
开发者ID:nakedwarrior,项目名称:larashop,代码行数:18,代码来源:ViewOrderAuthorize.php

示例15: success

 public function success(Buckaroo $buckaroo, Request $request)
 {
     $order = Order::find($buckaroo->invoice_nr(Request::all()));
     $order->payed = 1;
     $order->saveitems(Cart::content());
     $order->save();
     $event = Event::fire(new ItemsPurchasedEvent($order, Cart::content()));
     Session::forget('order');
     Cart::destroy();
     return view("shoppingcart.payment-success");
 }
开发者ID:HEERLIJKNL,项目名称:WeRotterdam,代码行数:11,代码来源:PaymentController.php


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