mardi 29 mai 2018

delete item from cart

I want to delete item from cart I

I try to delete It by use this function :

public function deleteItemFromCart($id)
    {
        $items = session('cart');
        foreach ($items as $key => $value)
        {
            if ($value['item']['id'] == $id) 
            {                
                unset($items [$key]);            
            }
        }

        $request->session()->push('cart',$items);

        return redirect()->with('success', 'deleted from cart successfully');
    }



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IX9RC2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire