Esempio n. 1
0
 public function checkOut()
 {
     $order = new \App\Models\Order();
     $order->user_id = \Auth::user()->id;
     $order->status = 'Pending';
     $order->save();
     foreach (\Cart::contents() as $item) {
         $order->products()->attach($item->id, ['quantity' => $item->quantity]);
     }
     \Cart::destroy();
     return redirect('types/1');
 }
Esempio n. 2
0
 public function checkout()
 {
     $order = new \App\Models\Order();
     $order->user_id = \Auth::user()->id;
     $order->status = "Pending";
     $order->save();
     foreach (Cart::contents() as $item) {
         $order->products()->attach($item->id, ["quantity" => $item->quantity]);
     }
     Cart::destroy();
     return redirect("types/1");
 }