mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 22:01:48 +00:00
feat: clean up and starting documentation
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user