marksihor / laravel-cart
Laravel Cart
Installs: 1 862
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- laravel/framework: ~7.0
This package is auto-updated.
Last update: 2025-01-18 00:56:37 UTC
README
Installing
$ composer require marksihor/laravel-cart -vvv
CONFIGURATION
- Run the command in your terminal
$ php artisan vendor:publish --provider="MarksIhor\\LaravelCart\\CartServiceProvider" --tag=config
- Open config/app.php and add this line to your Aliases
'Cart' => MarksIhor\LaravelCart\Facades\CartFacade::class,
- Open App\Http\Kernel.php and add this line to $routeMiddleware array
'cart' => \MarksIhor\LaravelCart\Http\Middleware\CartMiddleware::class,
- Use "cart" middleware on routes you nedd to access cart
Usage examples
\Cart::addItem([ 'product_id' => $product->id, 'seller_id' => $product->user_id, 'attributes' => $attributes, 'price' => $product->price ]); \Cart::getCart(); \Cart::getCart($cartId); \Cart::getContentArray(); \Cart::getContentArray($cartId); \Cart::getContent(); \Cart::getContent($cartId); \Cart::deleteItem($itemId); \Cart::clearCart(); \Cart::clearCart($itemId); \Cart::getTotal($type); // price|total|discount|quantity \Сart::getTotal($type, $cartId); \Cart::updateItem($item, $data);
License
MIT