Reputation: 101
I am using Crinsane/LaravelShoppingcart
with Laravel 5. When I try to add items to Cart then it will display error
Non-static method Gloudemans\Shoppingcart\Cart::add() should not be called statically, assuming $this from incompatible context
Any help for resolve this..
Upvotes: 1
Views: 3891
Reputation: 167
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;
.
Upvotes: 0
Reputation: 549
Add this line at the top of your PHP file:
use Cart;
instead of this:
use Gloudemans\Shoppingcart\Cart;
Upvotes: 5