LaravelShoppingcart icon indicating copy to clipboard operation
LaravelShoppingcart copied to clipboard

Destroy cart

Open maxim8181 opened this issue 2 years ago • 3 comments

Hello Is there a way to destroy all carts of we do not know their name?

Thanks

maxim8181 avatar Jul 09 '21 07:07 maxim8181

You could delete all Carts from the cart table whereNotIn your known names but keep in mind thst carts could still be saved in sessions.

bumbummen99 avatar Jul 09 '21 08:07 bumbummen99

Thanks for answer but i do not understand, i would like destroy if Is possible all carts not just the instanced one even if i do not know the name of the carts

maxim8181 avatar Jul 09 '21 08:07 maxim8181

Thanks for answer but i do not understand, i would like destroy if Is possible all carts not just the instanced one even if i do not know the name of the carts

As i said, check whereNotIn() https://laravel.com/docs/8.x/queries#additional-where-clauses

Also, afaik the instanced cart is not saved in DB, maybe you can just truncate the whole table without a where at all.

bumbummen99 avatar Jul 09 '21 10:07 bumbummen99