public function postCheckoutbaru(Requests\CheckoutPaymentRequest $request) { $input = Session::get('values'); $customer = Customer::create($input); $tos = Cart::tos(); $total = Cart::total(); $od = array('order_date' => Carbon::now('Asia/Kuala_Lumpur'), 'total_tax' => $tos, 'total_purchase' => $total, 'order_status' => 0, 'customer_id' => $customer->id); $order = Order::create($od); $pp = array('order_id' => $order->id, 'time' => Input::get('time'), 'date' => Input::get('date'), 'ref_no' => Input::get('ref_no'), 'amount' => Input::get('amount'), 'pref_bank' => Input::get('pref_bank'), 'method' => Input::get('method')); $ppr = PaymentProof::create($pp); $formid = str_random(); $cart_content = Cart::content(); foreach ($cart_content as $cart) { $tr = array('product_id' => $cart->id, 'form_id' => $formid, 'qty' => $cart->qty, 'total_price' => $cart->subtotal, 'order_id' => $order->id, 'gambar_id' => $cart->options->img_id, 'color' => $cart->options->color, 'size' => $cart->options->size, 'category_id' => $cart->options->cat, 'month' => Carbon::now('Asia/Kuala_Lumpur')); Transaction::create($tr); } $data = array('name' => $customer->name, 'email' => $customer->email, 'no_tel' => $customer->no_tel, 'date' => Carbon::now('Asia/Kuala_Lumpur')); Mail::send('emails.invoice', $data, function ($message) { $input = Session::get('values'); $message->from('*****@*****.**', 'Sales'); $message->to($input['email'], $input['name'])->subject('Your Order Has Been Received'); }); Session::forget('values'); Cart::destroy(); return redirect('store/thankyou/'); }
public function getView($id) { $transactions = Transaction::where('order_id', '=', $id); return view('a.orderview', compact('transactions'))->with('customers', Customer::find($id))->with('orders', Order::find($id))->with('payments', PaymentProof::where('order_id', '=', $id)->get()); //$customers = Customer::find($id); //return view('a.orderview',compact('customers')); }