/**
  * add a checkout
  * @param  Request $request [description]
  * @return [type]           [description]
  */
 public function addCheckout(Request $request)
 {
     $checkout = new Checkout();
     $checkout = $request->all();
     Checkout::create($checkout);
     //update status room
     Room::where('name', $checkout['room_name'])->update(array('status' => 'A'));
     return redirect()->route('listroom_com');
 }
Exemplo n.º 2
0
 public function changeStatus($id, $status)
 {
     //
     //dd($id);
     $checkout = Checkout::findOrFail($id);
     $user = User::findOrFail($checkout->user_id);
     $current_status = "Order Placed";
     if ($status === '1') {
         $current_status = "Order Placed";
     } elseif ($status === '2') {
         $current_status = "Ready for Dispatch";
     } elseif ($status === '3') {
         $current_status = "In Transit";
     } elseif ($status === '4') {
         $current_status = "Delivered";
         Event::fire(new OrderDelivered($user, $checkout));
     }
     $checkout = Checkout::find($id);
     $checkout->status = $current_status;
     $checkout->save();
     //dd($checkout);
     return redirect()->route('orders');
 }
Exemplo n.º 3
0
 public function postCheckout()
 {
     //Take all fields from post form
     $input = Input::all();
     // do the validation ----------------------------------
     // validate against the inputs from our form-------
     $validator = Validator::make($input, Checkout::$rules);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         //var_dump($validator->messages());
         return redirect()->route('rental.checkoutForm')->withInput()->withErrors($validator)->withErrors($validator->getMessageBag());
     } else {
         // validation successful ---------------------------
         $checkout = Checkout::create(['user_id' => Auth::user()->id, 'email' => Input::get('email'), 'first_name' => Input::get('first_name'), 'last_name' => Input::get('last_name'), 'address' => Input::get('address'), 'zip' => Input::get('zip'), 'country' => Input::get('country'), 'state' => Input::get('state'), 'phone' => Input::get('phone'), 'description' => Input::get('description')]);
         $order_items = Cart::content(true);
         foreach ($order_items as $order) {
             DB::table('order_item')->insertGetId(['order_id' => $checkout->id, 'equipment_id' => $order['id'], 'price' => $order['price'], 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
         }
         var_dump($order_items);
         //redirect our user back to the form so they can do it all over again
         return redirect()->route('rental.index');
     }
 }
Exemplo n.º 4
0
 public function orderdetail($id)
 {
     $checkout = Checkout::with('orders', 'orders.product')->findorfail($id);
     return view('site.myorderdetail', compact('checkout'));
 }
Exemplo n.º 5
0
 public function confirmOrder($checkout_id)
 {
     $checkout = Checkout::findorfail($checkout_id);
     $checkout->status = "Order Placed";
     $checkout->save();
     $user = Sentinel::check();
     $user = User::findorfail($user->id);
     Event::fire(new MadeCheckout($user, $checkout));
     Cart::destroy();
     //clear cart data
     return redirect()->route('cart.orderplaced');
 }