I'm trying to set up this shopping cart library in Laravel, but I keep getting Non-static method Darryldecode\Cart\Cart::add() should not be called statically, assuming $this from incompatible context
https://github.com/darryldecode/laravelshoppingcart
here's my controller code:
public function getCart(){
$cartCollection = Cart::getContent();
return response()->json($cartCollection->toArray());
}
public function updateCart( Request $request, $id ){
$input = $request->all();
Cart::update($id, array_except($input, array('_token')));
}
public function addToCart( Request $request ){
$input= $request->all();
Cart::add(array_except($input, array('_token')));
}
public function removeFromCart( $id ){
Cart::remove($id);
}
my confusion is that the documentation for this library says that you should be calling the methods statically. I also tried using the dependency ejection method, and that threw a different error. Any help with this would be greatly appreciated.
I'm pretty new to Laravel so forgive me if this is a dumb oversight.
also I fallowed all the steps to set up this library, including adding it to the App.php providers array and the aliases array.