當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。