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