当前位置: 首页>>代码示例>>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;未经允许,请勿转载。