public function createDummyOrders() { $this->syncDeliveryZones(3); exit; //static data $input = array("meal_plan_id" => 254, "zone_id" => 1, "state_code" => "CA"); echo "<pre>"; //input data randomized $recipient = array("lr3nRmFE50bWm0dGdPH8rfeZ", "64r7AdG6q7oLmhvsVXGBIhZN", "K4M1OGiMkopR~fBSdiDKjJ6*"); $rand = rand(0, 2); $input['recipient_id'] = $recipient[$rand]; $db_exists = $this::setCurrentDatabase($input['state_code']); $OrderHelper = new OrderHelper(); $market_office_id = $OrderHelper->getMarketOfficeCity($input['zone_id']); $mrkt_ofc_data = $OrderHelper->getMarketOfficeData($market_office_id); $customer = Customer::orderBy(DB::raw("RAND()"))->first(); $food = $OrderHelper->getMenuItems($input['meal_plan_id']); $gross_amount = 0; //to be added to database $order = array(); $order['state_code'] = $input['state_code']; $order['market_office_id'] = $market_office_id; $order['market_office_name'] = $mrkt_ofc_data['office_name']; $order['market_office_city_id'] = MarketOfficeCityDeliveryZones::where('id', '=', $input['zone_id'])->pluck('market_office_city_id'); $order['market_office_city_name'] = MarketOfficeCity::where('id', '=', $order['market_office_city_id'])->pluck('city_name'); $order['market_office_city_delivery_zone_id'] = $input['zone_id']; $order['market_office_city_delivery_zone_name'] = MarketOfficeCityDeliveryZones::where('id', '=', $input['zone_id'])->pluck('delivery_zone_name'); $order['customer_id'] = $customer->id; $order['customer_delivery_address'] = $customer->address; $order['meal_plan_id'] = $input['meal_plan_id']; $order['meal_plan_name'] = $OrderHelper->getCurrentMealCategory($input['meal_plan_id']); $order['tax_percentage'] = $mrkt_ofc_data['tax_percentage']; $order['tax_amount'] = 0; $order['gross_amount'] = 0; $order['coupon_id'] = 0; $order['coupon_code'] = NULL; $order['coupon_amount'] = "0.00"; $order['credit'] = "0.00"; $order['tips_percentage'] = "0"; $order['tips_amount'] = "0.00"; $order['total_amount'] = $gross_amount + $order['tax_amount']; $order['note'] = ""; $order['phone'] = $customer->phone; $order['order_status'] = "Processing"; $order['created_at'] = date('Y-m-d H:i:s'); $lastOrderId = Order::insertGetId($order); echo $lastOrderId . "\n"; $orderDetails = $OrderHelper->insertOrderDetails($food, $lastOrderId); print_r($orderDetails); $menu_food = array(); foreach ($orderDetails as $val) { $obj['food_id'] = $val['menu_item_id']; $obj['food_qty'] = $val['quantity']; $menu_food[] = (object) $obj; $gross_amount += $val['amount']; } $hash = sha1($lastOrderId . uniqid(mt_rand())); $order_number = sha1($lastOrderId . uniqid(mt_rand())); $transactionId = 0; $card_number = "NDI0Mg=="; $cardType = "Visa"; $order_number = $input['state_code'] . '00' . $lastOrderId; $tax_amount = round($gross_amount * ($order['tax_percentage'] / 100), 2); $total_amount = $gross_amount + $tax_amount; Order::where('id', '=', $lastOrderId)->update(array('transaction_id' => $transactionId, 'card_number' => $card_number, 'card_type' => $cardType, 'hash' => $hash, 'order_number' => $order_number, 'payment_status' => 'Charged', 'gross_amount' => $gross_amount, 'tax_amount' => $tax_amount, 'total_amount' => $total_amount)); $order['order_id'] = $lastOrderId; $order['food'] = $menu_food; $order['recipient_id'] = $input['recipient_id']; #$ApiRedis = new ApiRedis(); $b = $this->syncDeliveryZones(1); $c = $this->pushOrderIntoQueue($lastOrderId, 0); $d = $this->pushOrderIntoHash($lastOrderId, $order); var_dump($b); var_dump($c); var_dump($d); print_r($order); echo $order_number . "\n" . $transactionId . "\n" . $hash . "\n" . $card_number . "\n" . $cardType . "\n" . $gross_amount . "\n" . $tax_amount; // $ApiRedis->pushOrderIntoQueue($order); }