當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Order::findOrFail方法代碼示例

本文整理匯總了PHP中app\Order::findOrFail方法的典型用法代碼示例。如果您正苦於以下問題:PHP Order::findOrFail方法的具體用法?PHP Order::findOrFail怎麽用?PHP Order::findOrFail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Order的用法示例。


在下文中一共展示了Order::findOrFail方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: callback

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function callback(Request $request)
 {
     parse_str(base64_decode(strtr($request->get('data'), array('-' => '+', '_' => '/'))), $params);
     $order = Order::findOrFail($params['orderid']);
     $order->setStatus(Config::get('paysera.statuses.' . $params['status']));
     return 'OK';
 }
開發者ID:gecas,項目名稱:LaravelPaysera,代碼行數:12,代碼來源:PayseraController.php

示例2: 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

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $order = Order::findOrFail($id);
     $categories = Category::all();
     $products = Product::where('category_id', '=', $categories[0]->id)->get();
     return view('order.show', compact('order', 'categories', 'products'));
 }
開發者ID:alexdachin,項目名稱:phppos,代碼行數:13,代碼來源:OrderController.php

示例4: destroy

 public function destroy($id)
 {
     $order = Order::findOrFail($id);
     $deleted = $order->delete();
     $message = $deleted ? 'Pedido eliminado correctamente!' : 'El Pedido NO pudo eliminarse!';
     return redirect()->route('admin.order.index')->with('message', $message);
 }
開發者ID:primitivorm,項目名稱:tienda,代碼行數:7,代碼來源:OrderController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function update($id, Request $request)
 {
     $order = Order::findOrFail($id);
     $order->update($request->all());
     Session::flash('flash_message', 'Order updated!');
     return redirect('admin/orders');
 }
開發者ID:ercancavusoglu,項目名稱:CRUD-Ecommerce,代碼行數:14,代碼來源:OrdersController.php

示例6: destroy

 public function destroy($id)
 {
     $order = Order::findOrFail(id);
     $deleted = $order->delete();
     $message = $deleted ? "Pedido eliminado" : "Error al intentar eliminar el pedido";
     return redirect()->route('admin.order.index')->with('message', $message);
 }
開發者ID:aleksAE,項目名稱:Store-Laravel5.1,代碼行數:7,代碼來源:OrderController.php

示例7: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $order = Order::findOrFail($id);
     $order_details = DB::table('order_details')->where('order_id', '=', $id)->get();
     $supplier = Supplier::where('id', '=', $order->supplier_id)->firstOrFail();
     $created_at = $order->created_at->format('Y M d');
     return view('orders.single-order', compact('order', 'order_details', 'supplier', 'created_at'));
 }
開發者ID:suxiid,項目名稱:application,代碼行數:14,代碼來源:OrdersController.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     if (Auth::user()->admin == 1) {
         $order = Order::findOrFail($id);
     } else {
         $order = Order::where('group', Auth::user()->group)->where('id', $id)->firstOrFail();
     }
     return view('order.show', ['order' => $order]);
 }
開發者ID:Balauue,項目名稱:komilitona,代碼行數:15,代碼來源:OrderController.php

示例9: makePayment

 public static function makePayment($data)
 {
     try {
         Order::findOrFail($data['order_id'])->setStatus(Config::get('paysera.statuses.2'));
         $payment_data = ['projectid' => Config::get('paysera.projectid'), 'sign_password' => Config::get('paysera.sign_password'), 'currency' => Config::get('paysera.currency'), 'country' => Config::get('paysera.country'), 'test' => Config::get('paysera.test'), 'orderid' => $data['order_id'], 'amount' => intval($data['amount'] * 100), 'accepturl' => route('front.order.show', [$data['order_id']]), 'cancelurl' => route('front.order.show', [$data['order_id']]), 'callbackurl' => route('artme.paysera.callback', [])];
         $request = WebToPay::redirectToPayment($payment_data, true);
     } catch (WebToPayException $e) {
         // handle exception
     }
 }
開發者ID:gecas,項目名稱:LaravelPaysera,代碼行數:10,代碼來源:Paysera.php

示例10: approveOrder

 public function approveOrder(Request $request)
 {
     $order_id = $request->input('order_id');
     $order = Order::findOrFail($order_id);
     try {
         event(new OrderWasApproved($order));
         $order->confirmed = true;
         $order->save();
     } catch (Card $e) {
         return response()->json(['success' => false, 'message' => 'Your card was declined, please try again.'], 402);
     } catch (Base $e) {
         return response()->json(['success' => false, 'message' => 'The transaction did not go through, please try again.'], 402);
     } catch (Authentication $e) {
         return response()->json(['success' => false, 'message' => 'The API key provided is wrong, please make sure that you are using the correct keys.'], 402);
     }
     return response()->json(['success' => true, 'message' => 'The card was successfully charged'], 200);
 }
開發者ID:Reached,項目名稱:webshop,代碼行數:17,代碼來源:OrdersController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = Auth::User();
     $cart = DB::table('orders')->select('id')->where('status_id', '=', 1)->where('user_id', '=', $user->id)->value('id');
     $cartQuantity = DB::table('order_products')->where('order_id', '=', 40)->sum('quantity');
     if ($cart == null) {
         $order = new Order();
         $order->user_id = $user->id;
         $order->status_id = 1;
         $order->save();
     }
     $items = Order::findOrFail($cart)->product()->get();
     $sum = 0;
     foreach ($items as $item) {
         $sum += number_format($item->pivot->quantity * $item->price, 2);
     }
     return view('cart.index', ['items' => $items, 'sum' => $sum, 'user' => $user]);
 }
開發者ID:samyerkes,項目名稱:sweet.com,代碼行數:23,代碼來源:CartController.php

示例12: printReport

 public function printReport(Request $request)
 {
     $this->data['reward'] = Price::all();
     $this->data['company'] = $request->input('company');
     $this->data['date_from'] = $request->input('date_from');
     $this->data['date_to'] = $request->input('date_to');
     foreach ($request->input('select') as $val) {
         $this->data['orders'][] = Order::findOrFail($val);
         $order = Order::findOrFail($val);
         if ($order->departure_order_type == 1) {
             $this->data['dep'][] = $order->departure_passengers * $this->data['reward'][0]->reward;
         } else {
             $this->data['dep'][] = $this->data['reward'][$order->departure_order_type - 1]->reward;
         }
         if ($order->arrivals_order_type == 1) {
             $this->data['arr'][] = $order->arrivals_passengers * $this->data['reward'][0]->reward;
         } else {
             $this->data['arr'][] = $this->data['reward'][$order->departure_order_type - 1]->reward;
         }
     }
     return $this->render('reports.print-report');
 }
開發者ID:pz6tnk,項目名稱:laravel-CRM,代碼行數:22,代碼來源:ReportsController.php

示例13: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     // add authorize function to prevent user view other user's order
     $order = \App\Order::findOrFail($id);
     return view('orderdetail', compact('order'));
 }
開發者ID:nakedwarrior,項目名稱:larashop,代碼行數:12,代碼來源:OrderController.php

示例14: declineOrder

 public function declineOrder($id)
 {
     $order = Order::findOrFail($id);
     $order->decline();
     return redirect()->to('panel/Orders');
 }
開發者ID:ikliko,項目名稱:Maxverf,代碼行數:6,代碼來源:OrderController.php

示例15: orderChangeStatus

 function orderChangeStatus($order_id)
 {
     if ($order = \App\Order::findOrFail($order_id)) {
         if ($order->sent_flag == 1) {
             $order->sent_flag = 0;
         } else {
             $order->sent_flag = 1;
         }
         if ($order->save()) {
             return Redirect::back()->with('success', 'Status changed successfully.');
         } else {
             return Redirect::back()->with('error', 'Unable to change status. Please try again.');
         }
     } else {
         return redirect("admin/orders")->with('error', 'Unable to find the order. Please try again.');
     }
 }
開發者ID:susmithageorge,項目名稱:aslu_order_system,代碼行數:17,代碼來源:AdminController.php


注:本文中的app\Order::findOrFail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。