| Package Data | |
|---|---|
| Maintainer Username: | aharen |
| Maintainer Contact: | hello@khusaam.com (Ahmed Khusaam) |
| Package Create Date: | 2016-08-13 |
| Package Last Update: | 2016-08-13 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-06 15:01:58 |
| Package Statistics | |
|---|---|
| Total Downloads: | 58 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 0 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
Simple Session based cart for shopping websites in Laravel
composer require aharen/cart
Add CartServiceProvider to providers in config/app.php
aharen\Cart\CartServiceProvider::class,
Add Cart Facade to aliases in config/app.php
'Cart' => aharen\Cart\CartFacade::class,
Publish the config file to config folder
php artisan vendor:publish
If so some reason it doesn't create the config file you have to create a file named cart.php inside the config folder with the contents below
<?php
return [
'name' => 'yourcartnamehere',
];
Get the current contents of the cart. Will return false if the cart is empty
Cart::get();
Cart::count();
The first parameter is your item. It can either be an ID or item name. The second parameter has to be numeric which is the Quantity.
Cart::add('Pizza Slice', 2);
Accepts only 1 parameter, which is your item ID or item name
Cart::remove('Pizza Slice');
Empties your current cart
Cart::reset();