feat: clean up and starting documentation

This commit is contained in:
Joel Male
2025-02-25 14:53:49 +10:00
parent 8d6e1bcc26
commit ec99aa0563
9 changed files with 111 additions and 73 deletions
+25 -1
View File
@@ -20,7 +20,8 @@ ## Table of Contents
- [Configuration](#configuration)
- [Basic Usage](#basic-usage)
- [Conditions](#conditions)
- [Items](#items)
- [Cart Items](#cart-items)
- [Database Support](#database-support)
- [Credits](#-credits)
- [License](#-license)
@@ -684,6 +685,29 @@ ### Cart Items
$item->getPriceSumWithConditions();
```
### Database Support
Sometimes you might want to store the cart in the database so that the cart can be retrieved even after the user logs out or closes the browser.
You may also find yourself wanting to add cart timeouts and support for multiple computers.
To get started, you'll need to create a new model for your Cart, the package requires only 3 columns, but you're free to extend this as you wish:
```php
$table->string('session_id');
$table->text('items');
$table->text('conditions');
```
Then add some json casts to your model:
```php
protected $casts = [
'items' => 'array',
'conditions' => 'array',
];
```
## 🫡 Credits
This package was orignally created by [darryldecode](https://github.com/darryldecode) but has since seen almost no updates. I have decided to take the old package and transform it into a new package with new features and updates.