Exemple #1
0
 /**
  * Handle the event.
  *
  * @param  MadeCheckout  $event
  * @return void
  */
 public function handle(MadeCheckout $event)
 {
     //
     $user = $event->user;
     $checkout = $event->checkout;
     //dd($checkout);
     $orders = Order::where('checkout_id', $checkout->id)->get();
     foreach ($orders as $order) {
         Tempcart::where('user_id', $user->id)->where('product_id', $order->product_id)->delete();
     }
 }
Exemple #2
0
 public function remove($id)
 {
     $order = Cart::get($id);
     if ($user = Sentinel::check()) {
         $tempcart = Tempcart::where('user_id', $user->id)->where('product_id', $order->id)->where('pqty_id', $order->options->pid)->delete();
     }
     Cart::remove($id);
     $trolleycart = ['count' => Cart::count(), 'total' => Cart::total()];
     return response()->json($trolleycart);
 }