GitHub - freshbitsweb/laravel-cart-manager: Managing the cart in your Laravel ap...
source link: https://github.com/freshbitsweb/laravel-cart-manager
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
Cart Manager for Laravel 5.5+
Let's make the cart management with Laravel a breeze.
Just another shopping cart package?
There are a few well maintained shopping cart packages available but I wanted to have a solution which feels like the Laravel way and is more coupled with the database and provides additional functionality like shipping charges, discount, tax, total, round off, guest carts, etc. out-of-box while staying a very easy to use package.
Why/when to use?
Let us decide when this package should be used:
- You are looking for an easy to use solution which provides cart feature for users as well as guests.
- You want to make sure that the carting can work via APIs as well to support mobile applications.
- You want features like Shipping charges, tax, discount, round off, etc.
- You want to store cart data in Database, session or at a custom place.
- You like using the packages which are more like the Laravel way
Installation
- Install the package by running this command in your terminal/cmd:
composer require freshbitsweb/laravel-cart-manager
- Import config file by running this command in your terminal/cmd:
php artisan vendor:publish --tag=laravel-cart-manager-config
- Import migrations files by running this command in your terminal/cmd:
php artisan vendor:publish --tag=laravel-cart-manager-migrations
- Add a trait to the model(s) of cart items:
...
use Freshbitsweb\LaravelCartManager\Traits\Cartable;
...
class Product extends Model
{
use Cartable;
...
}
Usage - As Easy as 1 2 3
// Add to cart
$cart = Product::addToCart($productId);
// Remove from cart
$cart = cart()->removeAt($cartItemIndex);
// Apply discount
$cart = cart()->applyDiscount($percentage);
// Fetch cart
$cart = cart()->toArray();
Online Demo
The demo of the package can be found at - https://laravel-cart-manager.freshbits.in
Detailed Documentation
Checkout the full documentation.
Tests
Run this command to run the tests of the package:
composer test
Authors
- Gaurav Makhecha - Initial work
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE file for details
Special Thanks to
- Laravel Community
Recommend
-
108
-
79
README.md Laravel Log Enhancer (Laravel 5.6) Laravel's logging system helps a lot for storing data as well as while troubleshooting some hidden bugs. The data related to the exception automatic...
-
894
README.md
-
28
Crooks who hack online merchants to steal payment card data are constantly coming up with crafty ways to hide their malicious code on Web sites. In Internet ages past, this often meant obfuscating it as giant blobs of gib...
-
9
JSON representation of an empty shopping cart. · GitHub Instantly share code, notes, and snippets.
-
10
JSON representation of an active shopping cart. · GitHub Instantly share code, notes, and snippets.
-
9
paid-cart.json · GitHub Instantly share code, notes, and snippets. { "_state": "paid", "paidItems": [ {...
-
2
Tech DriversAlexa will now tell you when items in your Amazon cart or wish list go on salePublished Thu, Mar 31 202212:00 PM EDTUpdated Thu, Mar 3...
-
6
Operand Deployment Lifecycle Manager (ODLM) Overview Note: Documents in this repo are in active development. For the official documentation, see
-
2
Sander Opdenakker May 11, 2023 2 minute read...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK