Closed sha-phpnerd closed 8 years ago
You should call the add()
method on the facade, not on the actual class.
use Cart;
i try use Cart. and i find this eror.. please help. i found same eror
@ilhamsabar You will have to use the facade, you're trying to call the add method statically on the actual Cart class.
So don't do use Gloudemans\Shoppingcart\Cart;
but use Cart;
or use Gloudemans\Shoppingcart\Facades\Cart;
.
How to get table for this LaravelShoppingcart packages?
I tried
$c = new Cart(?,?);
$c->add('192ao12', 'Product 1', 1, 9.99);
What to put in the hell two arguments while instantiating?
@shahidkarimi You either use the facade and call the add method on that. If you want to create an instance of the cart yourself, either use the service container, so something like app(Cart::class)
or let Laravel inject it into the class constructor or something for you. If you really want to do it like the code you showed me, take a look at the actual code to see what it needs.
But there's not really any need to instantiate the cart yourself like that.
please I had the same issue i used use Cart; but it gave me a new error saying provide a valid name
round function is not working. showing a non numeric value encountered, when i use Cart::total(). Please help me.
Non-static method Gloudemans\Shoppingcart\Cart::add() should not be called statically, assuming $this from incompatible context
Im using laravel 5.1 ; there i dont find any static method. Please help !!