laravelshoppingcart
laravelshoppingcart copied to clipboard
how to get the instance 'default'
hello
I am trying to get the default instance of cart.
my route in web.php: Route::get('empty',function(){ Cart::instance('default')->destroy(); });
I hope you can help me with this thanks in advance
You have two options:
-
Override default session key using
Cart::session('default')->add(...)when adding items to the cart. More info here: https://github.com/darryldecode/laravelshoppingcart#important-note -
Change
$session_keyto "default" onShoppingCartServiceProvider.php.
In both cases you can access cart contents with Cart::session('default')->getContent().