/**
  * 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'));
 }
Beispiel #2
0
 public function index()
 {
     $users = Order::all();
     $orders = Order::orderBy('id', 'desc')->paginate(5);
     //dd($orders);
     return view('admin.order.index', compact('orders', 'users'));
 }
 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'));
 }
Beispiel #4
0
 /**
  * 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));
 }
Beispiel #5
0
 public function getAll()
 {
     $orders = Order::all();
     $pageData = self::orderPageData('pending', 0, 1, 1, 1);
     $pageData['table'] = $orders;
     return view('panel.orders', $pageData);
 }
 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('*****@*****.**', 'MEI - Student Rental');
         $message->to($user_order->email)->subject('MEI - Student Rental Order');
         $message->bcc(['*****@*****.**']);
         //  $message->bcc('*****@*****.**')->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.');
 }
 /**
  * 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/>";
     }
 }
 /**
  * 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'));
 }
Beispiel #9
0
 /**
  * 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]);
 }
Beispiel #10
0
 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 />";
     }
 }
 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;
 }
Beispiel #12
0
 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]);
 }
 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);
 }
Beispiel #14
0
 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);
 }
 /**
  * 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'];
             }
         }
     }
 }
 public function run()
 {
     $faker = $this->getFaker();
     $orders = Order::all();
     $equipment = Equipment::all()->toArray();
     foreach ($orders as $order) {
         $used = [];
         for ($i = 0; $i < rand(1, 5); $i++) {
             $product = $faker->randomElement($equipment);
             if (!in_array($equipment["id"], $used)) {
                 $id = $equipment["id"];
                 $price = $equipment["price"];
                 $quantity = rand(1, 3);
                 OrderItem::create(["order_id" => $order->id, "equipment_id" => $id, "price" => $price, "quantity" => $quantity]);
                 $used[] = $equipment["id"];
             }
         }
     }
 }
 public function __construct()
 {
     View::share('pros', Product::take(8)->Where('status', 1)->orderBy('created_at', 'DESC')->get());
     View::share('customs', Product::take(8)->Where('type', 0)->orderBy('created_at', 'DESC')->get());
     View::share('products', Product::take(8)->Where('status', 1)->orderBy('created_at', 'DESC')->get());
     View::share('cus', Product::take(8)->Where('status', 1)->orderBy('created_at', 'ASC')->get());
     View::share('categories', Category::all());
     View::share('cart_content', Cart::content());
     View::share('count', Cart::count());
     View::share('total', Cart::total());
     View::share('set', Setting::find(1));
     View::share('tos', Cart::tos());
     View::share('transactions', Transaction::orderBy('created_at', 'desc')->paginate(10));
     View::share('settings', Setting::find(1));
     View::share('caty', Category::take(5)->orderBy('created_at', 'DESC')->get());
     View::share('payments', Payment::Where('status', 1)->get());
     View::share('customers', Customer::all());
     View::share('orders', Order::all());
     View::share('cat', Category::all());
     View::share('db', Product::take(6)->Where('status', 1)->orderBy('created_at', 'ASC')->get());
 }
 public function getIndex()
 {
     $now = Carbon::now('Asia/Kuala_Lumpur');
     $monthStart = $now->startOfMonth();
     $monthEnd = $now->endOfMonth();
     $tempahan = Order::orderBy('created_at', $monthStart);
     // where('created_at', '>=', Carbon::now()->startOfMonth())->get()
     $kato = Category::whereHas('transaction', function ($query) {
         $query->where('qty', '>', 0);
         $query->where('created_at', '>=', Carbon::now('Asia/Kuala_Lumpur')->startOfYear());
     })->get();
     $katoo = Category::whereHas('transaction', function ($query) {
         $query->where('qty', '>', 0);
         $query->where('created_at', '>=', Carbon::now('Asia/Kuala_Lumpur')->startOfMonth());
     })->get();
     $overall = Transaction::select('id', 'created_at', 'month', DB::raw('sum(qty) as total'))->groupBy(DB::raw('MONTH(month)'))->orderBy('created_at', 'asc')->where('created_at', '>=', Carbon::now('Asia/Kuala_Lumpur')->startOfYear())->get();
     $testo = Transaction::select('id', 'month')->groupBy(DB::raw('MONTH(month)'))->orderBy('month', 'asc');
     $tahun = Carbon::now('Asia/Kuala_Lumpur')->startOfYear();
     $tran = Transaction::all();
     $tops = Transaction::orderBy('qty', 'desc')->groupBy('product_id')->limit(5)->where('created_at', '>=', Carbon::now('Asia/Kuala_Lumpur')->startOfWeek())->get();
     return view('a.index', compact('kato', 'katoo', 'tops', 'overall', 'tahun', 'testo'))->with('tempahan', $tempahan)->with('trans', $tran)->with('args', Order::all())->with('ris', Order::sum('total_purchase'))->with('name', $kato->lists('name'))->with('namo', $katoo->lists('name'));
 }
 public function getIndex()
 {
     $orders = Order::all()->take(15);
     return response()->json($orders->toArray());
 }
Beispiel #20
0
 /**
  * Создание нового заказа
  */
 public function postNewOrder(Request $request)
 {
     // DESC Проверка на временную отсечку
     $this->validate($request, array('customer' => 'required|integer', 'operator' => 'required|integer'));
     $year = date('y');
     $order = Order::all()->last();
     if (empty($order)) {
         $id = "0000";
     } else {
         $id = substr($order->ident, -4, 4);
         if (substr($order->ident, 0, 2) != date('y')) {
             $id = "0000";
         }
     }
     $ident = $year . "07" . $id;
     $ident++;
     $order = Order::create(array('ident' => $ident, 'user_id' => $this->user->id, 'customer' => $request->input('customer'), 'operator' => $request->input('operator'), 'phones' => $request->input('phones'), 'order_to_airport' => $request->input('order_to_airport'), 'order_from_airport' => $request->input('order_from_airport'), 'departure_time' => date("Y-m-d H:i:s", strtotime($request->input('departure_time'))), 'departure_passengers' => $request->input('departure_passengers'), 'departure_airport' => $request->input('departure_airport'), 'departure_order_type' => $request->input('departure_order_type'), 'arrivals_time' => date("Y-m-d H:i:s", strtotime($request->input('arrivals_time'))), 'arrivals_passengers' => $request->input('arrivals_passengers'), 'arrivals_airport' => $request->input('arrivals_airport'), 'arrivals_order_type' => $request->input('arrivals_order_type'), 'arrivals_flight_num' => $request->input('arrivals_flight_num'), 'amount' => $request->input('amount'), 'comment' => $request->input('comment')));
     if ($order) {
         return redirect()->action('OrderController@getOrderDoc', $ident);
     } else {
         $this->SetErrorNotifyMessage('Ошибка выполнения операции.');
         return redirect()->back();
     }
 }
 public static function listOrderAdmin()
 {
     return Order::all();
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $orders = Order::all();
     return view('orders.all')->with('orders', $orders);
 }
 public function index()
 {
     $orders = Order::all();
     return response()->json($orders);
 }
 public function index()
 {
     return view('index', ['orders' => Order::all()]);
 }
Beispiel #25
0
 public function dashboard()
 {
     $orders = Order::all();
     return view()->make('admin.dashboard', compact('orders'));
 }
Beispiel #26
0
 public function getIndex()
 {
     $data = array('orders' => Order::all());
     return view('pages.order', $data);
 }
Beispiel #27
0
 public function getShow(Request $request, $id = null)
 {
     $user = $request->user();
     if ($id == null && $user->isAdmin()) {
         //No ID means list all orders (for admins)
         $orders = Order::all();
         $orderData = array();
         foreach ($orders as $order) {
             $tmpOrder = array();
             $tmpOrder['id'] = $order->id;
             $tmpOrder['fullname'] = $order->user->fullname;
             $tmpOrder['total'] = 0.0;
             foreach ($order->items as $orderItem) {
                 $tmpOrder['total'] += $orderItem['price'] * $orderItem['weight'];
             }
             $tmpOrder['addr'] = $order->addr;
             $tmpOrder['phone'] = $order->phone;
             $tmpOrder['fulfilled'] = $order->fulfilled;
             $orderData[] = $tmpOrder;
         }
         return view('admin_order', ['orders' => $orderData]);
     }
     $order = Order::findOrFail($id);
     if ($user->id == $order->user_id || $user->isAdmin()) {
         $total = 0.0;
         $items = array();
         $orderItems = $order->items;
         foreach ($orderItems as $orderItem) {
             $item = array();
             $item['id'] = $orderItem->product->id;
             $item['name'] = $orderItem->product->name;
             $item['price'] = $orderItem->price;
             $item['count'] = $orderItem->weight;
             $item['total'] = $orderItem->price * $item['count'];
             $total += $item['total'];
             $items[] = $item;
         }
         $data = ['order' => $order, 'items' => $items, 'total' => $total];
         return view('order_show', $data);
     } else {
         //User not orderer or admin
         return redirect('/');
     }
 }
Beispiel #28
0
 public function index()
 {
     $files = File::with('client', 'technicien', 'laststatus.code')->get();
     $repairs = Repair::with('device')->get();
     $orders = Order::all();
     $leftmenu['files'] = 'active';
     return view('/files/index', ['leftmenu' => $leftmenu, 'files' => $files, 'repairs' => $repairs, 'orders' => $orders]);
 }
 public function index()
 {
     $orders = Order::all();
     return view('order.dashboard', compact('orders'));
 }
 public function getAllOrders()
 {
     return Order::all();
 }