Closed rashmi1403 closed 8 years ago
You can do it like so:
$WishlistCart = app('wishlist');
$WishlistCart->add(455, 'Sample Item', 100.99, 2, array());
I got this error when I tried using it like you mentioned.
Call to undefined method Darryldecode\Cart\Facades\CartFacade::add()
Your are using the wrong Cart class. Use \Cart::add() directly. See this link if you want some information about facade system: https://laravel.com/docs/5.1/facades
I am sorry, I am new to laravel and not getting this. Do you mean that I should update aliases in app.php with 'add' => 'Darryldecode\Cart::add()', and then use $WishlistCart->add(455, 'Sample Item', 100.99, 2, array()); with "use add;" at the beginning? I tried this and still get the same error.
And when I do use \Cart::add(); at the beginning, I get syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ',' or ';'
Just using 'Cart' => 'Darryldecode\Cart\Cart', instead of 'Cart' => 'Darryldecode\Cart\Facades\CartFacade' in Aliases in app.php solves the issue.
Call to undefined method Darryldecode\Cart\Cart::associate()
Hi,
I needed to create a new cart instance and retain the same one throughout the session. So I created a new service provider and added the code in the register() method. Now how do I use this cart name/ instance while adding or updating my cart contents?
Thank You!