@@ -26,7 +26,6 @@ For Laravel 5.5, 5.6, or 5.7~:
26
26
## CONFIGURATION
27
27
28
28
1 . Open config/app.php and add this line to your Service Providers Array.
29
- NOTE: If you are using laravel 5.5 or above, this will be automatically added by its auto discovery.
30
29
31
30
``` php
32
31
Darryldecode\Cart\CartServiceProvider::class
@@ -69,7 +68,7 @@ $rowId = 456; // generate a unique() row ID
69
68
$userID = 2; // the user ID to bind the cart contents
70
69
71
70
// add the product to cart
72
- Cart::session($userID)->add(array(
71
+ \ Cart::session($userID)->add(array(
73
72
'id' => $rowId,
74
73
'name' => $Product->name,
75
74
'price' => $Product->price,
@@ -79,26 +78,26 @@ Cart::session($userID)->add(array(
79
78
));
80
79
81
80
// update the item on cart
82
- Cart::session($userID)->update($rowId,[
81
+ \ Cart::session($userID)->update($rowId,[
83
82
'quantity' => 2,
84
83
'price' => 98.67
85
84
]);
86
85
87
86
// delete an item on cart
88
- Cart::session($userID)->remove($rowId);
87
+ \ Cart::session($userID)->remove($rowId);
89
88
90
89
// view the cart items
91
- $items = Cart::getContent();
90
+ $items = \ Cart::getContent();
92
91
foreach($items as $row) {
93
92
94
93
echo $row->id; // row ID
95
94
echo $row->name;
96
95
echo $row->qty;
97
96
echo $row->price;
98
97
99
- echo $row->model ->id; // whatever properties your model have
100
- echo $row->model ->name; // whatever properties your model have
101
- echo $row->model ->description; // whatever properties your model have
98
+ echo $item->associatedModel ->id; // whatever properties your model have
99
+ echo $item->associatedModel ->name; // whatever properties your model have
100
+ echo $item->associatedModel ->description; // whatever properties your model have
102
101
}
103
102
104
103
// FOR FULL USAGE, SEE BELOW..
0 commit comments