public function delivery() { $djt = Delivery::with('employee')->join('tblOrders', function ($join) { $join->on('tblDeliveries.strOrdDlvry', '=', 'tblOrders.strOrdersID'); })->join('tblSuppliers', function ($join3) { $join3->on('tblOrders.strSupplID', '=', 'tblSuppliers.strSuppID'); })->get(); $ids = DB::table('tblDeliveries')->select('strDlvryID')->orderBy('updated_at', 'desc')->orderBy('strDlvryID', 'desc')->take(1)->get(); $ID = $ids["0"]->strDlvryID; $newID = $this->smart($ID); $orders = Order::all(); $op = OrderProduct::all(); $ord = Order::lists('strOrdersID', 'strOrdersID'); $products = Product::lists('strProdName', 'strProdID'); $data = array('orders' => $ord, 'products' => $products); return View::make('delivery')->with('djt', $djt)->with('newID', $newID)->with('orders', $orders)->with('op', $op)->with('data', $data); }