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');
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire