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


PHP app\Order類代碼示例

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


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

示例1: checkOut

 public function checkOut(Request $request)
 {
     $address = \StringHelper::filterString($request->input('address'));
     $name = \StringHelper::filterString($request->input('name'));
     $content = \StringHelper::filterString($request->input('comments'));
     $phone = \StringHelper::filterString($request->input('phone'));
     $count = Cart::count();
     if ($phone != "" && $name != "" && $content != "" && $count > 0) {
         $order = new Order();
         $order->order_name = $name;
         $order->status = 1;
         $order->active = 1;
         $order->order_comment = $content;
         $order->order_address = $address;
         $order->order_phone = $phone;
         $order->save();
         $cart = Cart::content();
         foreach ($cart as $item) {
             $order_detail = new OrderDetail();
             $order_detail->dish_id = $item->id;
             $order_detail->dish_number = $item->qty;
             $order_detail->order_id = $order->id;
             $order_detail->save();
         }
         Cart::destroy();
         return Redirect::to(url('menu'))->with('message', 'Order Success !. You can continue buy now !');
     } else {
         return Redirect::to(url('checkout'))->with('message', 'Order Fail !. Something Wrong !');
     }
 }
開發者ID:huynt57,項目名稱:savvy-restaurant,代碼行數:30,代碼來源:CartController.php

示例2: newOrder

 public function newOrder($tableId)
 {
     $table = Table::find($tableId);
     // get last client sitting at this table
     $client = $table->clients()->orderBy('entertime', 'DESC')->first();
     //make new order
     $order = new Order();
     $order->starttime = Carbon::now('Europe/Brussels');
     $order->FK_client_id = $client->id;
     $order->save();
     $area = $table->area;
     $waiterAreas = $area->waiter_area()->where('start_time', '<', Carbon::now('Europe/Brussels'))->where('end_time', '>', Carbon::now('Europe/Brussels'))->get();
     $waiters = collect([]);
     //push all waiters with this waiterArea to array
     foreach ($waiterAreas as $waiterArea) {
         $waiters->push($waiterArea->waiter);
     }
     //send mail to all waiters in this area
     foreach ($waiters as $waiter) {
         Mail::send('emails.waiting', ['user' => $waiter, 'table' => $table], function ($m) use($waiter, $table) {
             $m->from(env('MAIL_FROM'), env('MAIL_NAME'));
             $m->to($waiter->email, $waiter->name)->subject('Tafel ' . $table->number . ' is aan het wachten.');
         });
     }
     return 'created';
 }
開發者ID:jimpeeters,項目名稱:ProjectInternetOfThings,代碼行數:26,代碼來源:OrderController.php

示例3: order

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function order()
 {
     $data = Input::all();
     $pay = Pay_method::where('pseudo_name', $data['payment'])->firstOrFail();
     $delivery = Delivery::where('pseudo_name', $data['delivery'])->firstOrFail();
     $order = new Order();
     $order->name = $data['name'];
     $order->telephone = $data['phone'];
     $order->adress = $data['address'];
     $order->email = $data['email'];
     $order->payment_method_id = $pay->id;
     $order->delivery_id = $delivery->id;
     $order->comment = $data['info'];
     $order->status = 'new';
     $order->total_cost = $data['sum'];
     $order->save();
     foreach ($data['cart'] as $name => $value) {
         $prod = Product::where('pseudo_name', $name)->firstOrFail();
         $ord_prod = new OrderProduct();
         $ord_prod->product_id = $prod->id;
         $ord_prod->count = $value;
         $ord_prod->order_id = $order->id;
         $ord_prod->save();
     }
     Mail::send('emails.order_success', ['data' => $data], function ($message) {
         $message->setEncoder(Swift_Encoding::get8BitEncoding());
         $message->to('adminemail@gmail.com', 'John Smith')->subject('New order!');
     });
     return 1;
 }
開發者ID:alaphant,項目名稱:kompot_test,代碼行數:35,代碼來源:ShopController.php

示例4: buildOrderFromAlpha

 private function buildOrderFromAlpha($alphaOrder)
 {
     $bravoOrder = $this->getBravoOrder($alphaOrder->order_number);
     $order = new Order();
     $order->fill(['order_number' => $alphaOrder->order_number, 'alpha' => $alphaOrder->alpha, 'bravo' => $bravoOrder->bravo]);
     return $order;
 }
開發者ID:cat5inthecradle,項目名稱:laravel-model-abstraction,代碼行數:7,代碼來源:OrderRepository.php

示例5: testPayMethodReturnFalse

 public function testPayMethodReturnFalse()
 {
     $order = new Order(new ProductList());
     $mockPaymentMethod = new MockFalseChargePaymentMethod();
     $order->setPaymentMethod($mockPaymentMethod);
     $this->assertFalse($order->pay());
 }
開發者ID:special-force,項目名稱:git-training,代碼行數:7,代碼來源:OrderTest.php

示例6: __construct

 public function __construct(Order $order)
 {
     if (!$order) {
         dd('vantar pöntun');
     }
     $this->order = $order;
     $this->testing = false;
     if (env('BORGUN_TEST') == true) {
         $this->site = 'https://test.borgun.is/SecurePay/default.aspx';
         $this->testing = true;
         $this->PaymentGatewayId = '16';
         $this->MerchantId = '9275444';
         $this->SecretKey = '99887766';
     } else {
         $this->site = 'https://securepay.borgun.is/securepay/default.aspx';
         $this->PaymentGatewayId = env('BORGUN_PAYMENTGATEWAYID');
         $this->MerchantId = env('BORGUN_MERCHANTID');
         $this->SecretKey = env('BORGUN_SECRETKEY');
     }
     $this->ReturnUrlSuccess = \Request::root() . '/payment/borgun/success';
     $this->ReturnUrlSuccessServer = \Request::root() . '/payment/borgun/successserver';
     $this->ReturnUrlCancel = \Request::root() . '/payment/borgun/cancel';
     $this->ReturnUrlError = '';
     $this->OrderId = $order->reference;
     $this->Amount = $order->total();
     $this->Currency = 'ISK';
     $this->Language = 'IS';
 }
開發者ID:stjanilofts,項目名稱:cp,代碼行數:28,代碼來源:Borgun.php

示例7: destroy

 /**
  * Destroy the given order.
  *
  * @param  Request  $request
  * @param  Order  $order
  * @return Response
  */
 public function destroy(Request $request, Order $order)
 {
     if (\Auth::id() == $order->user_id) {
         $order->delete();
     }
     return redirect('/orders');
 }
開發者ID:anhtt93,項目名稱:BookStore,代碼行數:14,代碼來源:OrderController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request, $id)
 {
     //總銷售金額
     $order = new Order();
     $_data['sell_total_money'] = $order->newQuery()->whereRaw('`status`>?', array(1))->sum('total_money');
     //總訂單數
     $_data['order_total_cnt'] = $order->newQuery()->count();
     //總商品數
     $product = new Product();
     $_data['product_total_cnt'] = $product->newQuery()->count();
     //總用戶數
     $user = new User();
     $_data['user_total_cnt'] = $user->newQuery()->count();
     $this->_week_start = $week_start = date("Y-m-d 00:00:00", strtotime("-" . (date("w") - 1) . " days"));
     //本周銷售
     $_data['sell_week_money'] = $order->newQuery()->whereRaw('created_at>= ? and `status`>?', array($week_start, 1))->sum('total_money');
     //本周訂單
     $_data['order_week_cnt'] = $order->newQuery()->whereRaw('created_at>= ?', array($week_start))->count();
     //本周商品
     $_data['product_week_cnt'] = $product->newQuery()->whereRaw('created_at>= ?', array($week_start))->count();
     //本周用戶
     $_data['user_week_cnt'] = $user->newQuery()->whereRaw('created_at>= ?', array($week_start))->count();
     $this->_data = $_data;
     return $this->view('admin.dashboard');
 }
開發者ID:unionbt,項目名稱:hanpaimall,代碼行數:30,代碼來源:HomeController.php

示例9: collect

 function test_an_order_is_discounted_by_a_percentage_when_a_percent_off_coupon_is_applied()
 {
     $books = collect([new Book(['price' => 2000]), new Book(['price' => 3000]), new Book(['price' => 4000])]);
     $coupon = new Coupon(['value' => 30, 'is_percent' => true]);
     $order = new Order($books);
     $order->applyCoupon($coupon);
     $this->assertEquals(6300, $order->total());
 }
開發者ID:adamwathan,項目名稱:lets-refactor-zendcon,代碼行數:8,代碼來源:AddCouponToOrderTest.php

示例10: createOrderWithProducts

 public function createOrderWithProducts()
 {
     $order = new Order();
     $product = new Product('Fallout 4', 59);
     $product2 = new Product('Pillowcase', 7);
     $order->add($product);
     $order->add($product2);
     return $order;
 }
開發者ID:rzani,項目名稱:laravel-test,代碼行數:9,代碼來源:OrderTest.php

示例11: Order

 /** @test */
 function an_order_can_determine_the_total_cost_of_all_its_products()
 {
     $order = new Order();
     $product = new Product('Fallout 4', 59);
     $product2 = new Product('pillowcase', 7);
     $order->add($product);
     $order->add($product2);
     $this->assertEquals(66, $order->total());
 }
開發者ID:pranayaryal,項目名稱:phptesting,代碼行數:10,代碼來源:OrderTest.php

示例12: cart

 public function cart()
 {
     $order = $this->orders()->where('order_status', 'cart')->first();
     if (!$order) {
         $order = new Order();
         $order->order_status = "cart";
         $order->user_id = $this->id;
         $order->save();
     }
     return $order;
 }
開發者ID:abada,項目名稱:shoppingcart-demo,代碼行數:11,代碼來源:User.php

示例13: store_adres

 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store_adres(Request $request)
 {
     $order = new Order();
     $order->fill($request->all());
     $order->email = $request->input('order_email');
     if ($request->input('email') && $request->input('password')) {
         $request->merge(array('name' => $order->Fullname));
         $this->postRegister($request);
     }
     Session::put("order", $order);
     return redirect('/shoppingcart/step/2');
 }
開發者ID:HEERLIJKNL,項目名稱:WeRotterdam,代碼行數:16,代碼來源:ShoppingcartController.php

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

示例15: storeOrders

 public function storeOrders()
 {
     // dd();
     $order = new Order(Request::all());
     $order->save();
     return $order;
     $surcharge_percentage = 0;
     $data = ['name' => trim($request->name), 'email' => trim($request->email), 'currency_purchased' => trim($request->currency_purchased), 'exchange_rate' => trim($request->exchange_rate), 'amount_paid' => trim($request->amount_paid)];
     if (trim($data['currency_purchased']) == 'USDGBP') {
         Helpers::sendMail($data, 'GBP Ordered');
     }
     // return response()->json(['message' => 'success']);
 }
開發者ID:johnymap,項目名稱:forex,代碼行數:13,代碼來源:ForexController.php


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