I downloaded the following library for laravel 8 shoppingcart https://github.com/hardevine/LaravelShoppingcart my composer.json
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"hardevine/shoppingcart": "^2.9",
"laravel/framework": "^8.12",
"laravel/tinker": "^2.5"
}
my shoppingcartController:
namespace AppHttpControllers;
use GloudemansShoppingcartCart;
use AppModelsProducts;
use IlluminateHttpRequest;
class ShoppingcartController extends Controller
{
public function add(){
$product=Products::find(request('id'));
Cart::add($product->id, $product->product_name, 1, $product->price);
return redirect()->route('shoppingCart')
->with('message_type','success')
->with('message','ürün sepete eklendi.');
}}
I save and refresh the page I get an error -->Non-static method GloudemansShoppingcartCart::add() should not be called statically