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


PHP Order::all方法代碼示例

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


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

示例1: dashboard

 /**
  * Dashboard Details
  *
  *
  */
 public function dashboard()
 {
     $products = Product::all()->count();
     $orders = Order::all()->count();
     $users = User::all()->count();
     return view('admin.dashboard', compact('products', 'orders', 'users'));
 }
開發者ID:hafizzain,項目名稱:mei-project,代碼行數:12,代碼來源:MeiController.php

示例2: index

 public function index()
 {
     $users = Order::all();
     $orders = Order::orderBy('id', 'desc')->paginate(5);
     //dd($orders);
     return view('admin.order.index', compact('orders', 'users'));
 }
開發者ID:kazamax,項目名稱:tienda,代碼行數:7,代碼來源:OrderController.php

示例3: index

 public function index()
 {
     $users = User::all();
     $orders = Order::all();
     $usersTotal = count($users);
     $ordersTotal = count($orders);
     $coffee1 = DB::table('coffees')->where('id', 1)->first();
     $coffee2 = DB::table('coffees')->where('id', 2)->first();
     $coffee3 = DB::table('coffees')->where('id', 3)->first();
     $coffee4 = DB::table('coffees')->where('id', 4)->first();
     $coffee5 = DB::table('coffees')->where('id', 5)->first();
     $pastry1 = DB::table('pastries')->where('id', 1)->first();
     $pastry2 = DB::table('pastries')->where('id', 2)->first();
     $pastry3 = DB::table('pastries')->where('id', 3)->first();
     $pastry4 = DB::table('pastries')->where('id', 4)->first();
     $pastry5 = DB::table('pastries')->where('id', 5)->first();
     $sum = 0;
     foreach ($orders as $order) {
         for ($i = 1; $i < 6; $i++) {
             $total = $order->{'coffee' . $i} * ${'coffee' . $i}->price + $order->{'pastry' . $i} * ${'pastry' . $i}->price;
             $sum = $sum + $total;
         }
     }
     $profit = 0;
     foreach ($orders as $order) {
         for ($i = 1; $i < 6; $i++) {
             $sales = $order->{'coffee' . $i} * (${'coffee' . $i}->price - ${'coffee' . $i}->cost) + $order->{'pastry' . $i} * (${'pastry' . $i}->price - ${'pastry' . $i}->cost);
             $profit = $profit + $sales;
         }
     }
     $rate = round($sum / $profit * 100, 2);
     return view('admin.dashboard', compact('usersTotal', 'ordersTotal', 'sum', 'rate'));
 }
開發者ID:jakzaizzat,項目名稱:KopiBean,代碼行數:33,代碼來源:AdminsController.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $orders = Order::all();
     return view('order.history', array('orders' => $orders));
     //     	$order = Order::find($id);
     //     	return view('order.show', array('order' => $order));
 }
開發者ID:owlein,項目名稱:laundrymgt,代碼行數:13,代碼來源:OrderController.php

示例5: getAll

 public function getAll()
 {
     $orders = Order::all();
     $pageData = self::orderPageData('pending', 0, 1, 1, 1);
     $pageData['table'] = $orders;
     return view('panel.orders', $pageData);
 }
開發者ID:ikliko,項目名稱:Maxverf,代碼行數:7,代碼來源:OrderController.php

示例6: postCheckout

 public function postCheckout()
 {
     $order_count = count(Order::all()) + 2;
     $order_number = "MEI-" . date('mdY') . "-" . $order_count;
     $product_ids = Session::get("pro_ids");
     $price = Session::get("price");
     $duration = Session::get("duration");
     $quantity = Input::get("quantity");
     $total_price_sum = Input::get("total-price-sum");
     $subtotal_price_sum = Input::get("subtotal-price-sum");
     foreach ($product_ids as $product_id) {
         $pro = Product::find($product_id);
         $order = new Order(array('product_id' => $product_id, 'order_number' => $order_number, 'quantity' => $quantity[$product_id], 'subtotal' => $subtotal_price_sum[$product_id], 'duration' => $duration[$product_id], 'price' => $price[$product_id]));
         $order->save();
     }
     $order_confirmed = new ConfirmOrders(array('order_number' => $order_number, 'total' => $total_price_sum, 'user_id' => Auth::user()->id));
     $order_confirmed->save();
     $order_confirmed = ConfirmOrders::find($order_confirmed->id);
     $user_order = $order_confirmed->user;
     $order_details = Order::where('order_number', $order_confirmed->order_number)->get();
     Mail::send(['html' => 'order-received'], ['order_details' => $order_details, 'order_confirmed' => $order_confirmed, 'user_order' => $user_order], function ($message) use($user_order) {
         $message->from('info@nmkelectronics.com', 'MEI - Student Rental');
         $message->to($user_order->email)->subject('MEI - Student Rental Order');
         $message->bcc(['zain@nmkelectronics.com']);
         //  $message->bcc('zain@nmkelectronics.com')->subject('MEI - Student Rental Order');
     });
     Session::forget('pro_ids');
     Session::forget('price');
     Session::forget('duration');
     return redirect('cart')->with('order_placed', 'Thank you for contacting us. We have received your enquiry and will respond to you soon. For urgent enquiries please call us on +9714 2659533.');
 }
開發者ID:hafizzain,項目名稱:mei-project,代碼行數:31,代碼來源:OrderController.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $orders = Order::all();
     foreach ($orders as $order) {
         echo $order->name . " Ordered by: " . $order->customer->name . "<br/>";
     }
 }
開發者ID:sebasw9,項目名稱:laravel-fun,代碼行數:12,代碼來源:OrderController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //$customers = Customer::has('orders')->get();
     $users = User::all();
     $orders = Order::all();
     $articles = Articles::all();
     return view('admin.index', compact('users', 'orders', 'articles'));
 }
開發者ID:jeezybrick,項目名稱:laravel_first,代碼行數:13,代碼來源:AdminController.php

示例9: index

 /**
  * Display a list of all of the user's orders.
  *
  * @param  Request  $request
  * @return Response
  */
 public function index(Request $request)
 {
     //        return view('orders.index', [
     //            'orders' => $this->orders->forUser($request->user()),
     //        ]);
     $orders = Order::all();
     return view('orders.index', ['orders' => $orders]);
 }
開發者ID:anhtt93,項目名稱:BookStore,代碼行數:14,代碼來源:OrderController.php

示例10: orders

 public function orders()
 {
     $orders = Order::all();
     foreach ($orders as $order) {
         $customer = Customer::find($order->customer_id);
         echo "Ordered by: " . $order->customer->name . "<br />";
         echo $order->name . "<p />";
     }
 }
開發者ID:Craig115,項目名稱:dev,代碼行數:9,代碼來源:OrderController.php

示例11: getAllOrders

 public function getAllOrders()
 {
     $orders = Order::all()->toArray();
     foreach ($orders as $order) {
         $orderProducts = Orderdetail::where(['OrderID' => $order->OrderID])->get(['ProductID'])->toArray();
         $order = array_add($order, 'products', $orderProducts);
     }
     return $orders;
 }
開發者ID:HomeFurnitures,項目名稱:HomeDecoWS,代碼行數:9,代碼來源:OrderService.php

示例12: admin

 public function admin()
 {
     $output = array();
     $i = 0;
     $orders = Order::all();
     foreach ($orders as $order) {
         $pivots = OrderProduct::where('order_id', $order->id)->get();
         foreach ($pivots as $pivot) {
             $prod = Product::findOrFail($pivot['product_id']);
             $output[$i]['order'] = $order;
             $p = ['prod' => $prod, 'count' => $pivot['count'], 'cost_all' => (int) $pivot['count'] * (int) $prod->cost];
             $output[$i]['product'][] = $p;
         }
         $i++;
     }
     return view('admin', ['data' => $output]);
 }
開發者ID:alaphant,項目名稱:kompot_test,代碼行數:17,代碼來源:HomeController.php

示例13: testNotificationStatus

 public function testNotificationStatus()
 {
     // Given
     $this->startSession();
     $order = new Order(['customer_name' => 'Marsellus Wallace', 'phone_number' => '+15551231234']);
     $order->save();
     $order = $order->fresh();
     $this->assertCount(1, Order::all());
     $this->assertEquals('Ready', $order->status);
     $this->assertEquals('None', $order->notification_status);
     // When
     $response = $this->call('POST', route('order.notification.status', ['id' => $order->id, 'MessageStatus' => 'sent']), ['_token' => csrf_token()]);
     // Then
     $order = $order->fresh();
     $this->assertEquals('Ready', $order->status);
     $this->assertEquals('sent', $order->notification_status);
 }
開發者ID:TwilioDevEd,項目名稱:eta-notifications-laravel,代碼行數:17,代碼來源:OrderControllerTest.php

示例14: index

 public function index()
 {
     $orders = Order::all();
     $sales = null;
     $taxes = null;
     foreach ($orders as $order) {
         $sales = $sales + $order->total;
         $taxes = $taxes + $order->sub_total;
     }
     $taxes = $sales - $taxes;
     $temperatures = Lava::DataTable();
     $temperatures->addDateColumn('Date')->addNumberColumn('Last period')->addNumberColumn('This period')->addRow(array('2015-11-1', 4524, 3503))->addRow(array('2015-11-2', 2332, 3880))->addRow(array('2015-11-3', 4700, 2130))->addRow(array('2015-11-4', 4200, 3100))->addRow(array('2015-11-5', 4302, 3500))->addRow(array('2015-11-6', 4130, 2332))->addRow(array('2015-11-7', 4820, 3200))->addRow(array('2015-11-8', 2504, 3500))->addRow(array('2015-11-9', 4500, 3500))->addRow(array('2015-11-10', 3350, 3500))->addRow(array('2015-11-11', 3350, 3100))->addRow(array('2015-11-12', 4500, 3555))->addRow(array('2015-11-13', 4500, 3330))->addRow(array('2015-11-14', 3350, 3200))->addRow(array('2015-11-15', 4500, 3500))->addRow(array('2015-11-16', 3350, 3500))->addRow(array('2015-11-17', 4500, 4500))->addRow(array('2015-11-18', 4500, 3500));
     $linechart = Lava::LineChart('Temps')->dataTable($temperatures)->title('Sales');
     //
     ///        dd(Lava::BackgroundColor());
     $viewBag = array('permission' => \Auth::user()->permission->name, 'orders' => $orders, 'orders_active' => Order::where('trash', '=', 0)->orderBy('created_at', 'desc')->take(5)->get(), 'sales' => $sales, 'taxes' => $taxes, 'products' => Product::where('trash', '=', 0)->get(), 'products_amount' => Product::where('stock', '=', 'N')->get(), 'users' => User::where('trash', '=', 0)->get(), 'categories' => Category::where('trash', '=', 0)->get());
     return \View::make('backend.index', $viewBag);
 }
開發者ID:stijnwop,項目名稱:breiShop,代碼行數:18,代碼來源:BackendController.php

示例15: run

 /**
  * Run the database seeds.
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $orders = Order::all();
     $products = Product::all()->toArray();
     foreach ($orders as $order) {
         $used = [];
         for ($i = 0; $i < rand(1, 5); ++$i) {
             $product = $faker->randomElement($products);
             if (!in_array($product['id'], $used)) {
                 $id = $product['id'];
                 $price = $product['price'];
                 $quantity = $faker->numberBetween(1, 3);
                 ItemOrder::create(['order_id' => $order->id, 'product_id' => $id, 'price' => $price, 'qty' => $quantity]);
                 $used[] = $product['id'];
             }
         }
     }
 }
開發者ID:xenxa,項目名稱:essensanaturaleonline,代碼行數:22,代碼來源:ItemOrderTableSeeder.php


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