@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public static function getProducts($id = null){ |
53 | 53 | if($id === null){ |
54 | 54 | $products = Product::all(); |
55 | - }else{ |
|
55 | + } else{ |
|
56 | 56 | $products = Category::find($id)->products; |
57 | 57 | } |
58 | 58 | return $products; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $html .= "<label>{$label}</label>"; |
77 | 77 | $html .= "<input class='form-control' type='{$type}' value='{$value}'>"; |
78 | 78 | return $html; |
79 | - }else{ |
|
79 | + } else{ |
|
80 | 80 | $html = ''; |
81 | 81 | $html .= "<label>{$label}</label>"; |
82 | 82 | $html .= "<textarea class='form-control'>{$value}</textarea>"; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if(isset($filter[$detail->id])){ |
118 | 118 | if($filter[$detail->id] == $detail_value_id){ |
119 | 119 | $selected = 'selected'; |
120 | - }else{ |
|
120 | + } else{ |
|
121 | 121 | $selected = ''; |
122 | 122 | } |
123 | 123 | } |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | |
16 | 16 | class Template |
17 | 17 | { |
18 | - public static function getStructureCategories(){ |
|
18 | + public static function getStructureCategories() { |
|
19 | 19 | |
20 | 20 | $categories = Category::with('children')->whereNull('parent_id')->get(); |
21 | 21 | $tree = []; |
22 | - foreach($categories as $category){ |
|
22 | + foreach ($categories as $category) { |
|
23 | 23 | $tree[] = [ |
24 | 24 | 'id' => $category->id, |
25 | 25 | 'text' => $category->name, |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | return $tree; |
31 | 31 | } |
32 | 32 | |
33 | - private static function recursiveChildren($childrens){ |
|
33 | + private static function recursiveChildren($childrens) { |
|
34 | 34 | $childs = []; |
35 | - foreach ($childrens as $children){ |
|
35 | + foreach ($childrens as $children) { |
|
36 | 36 | $childs[] = [ |
37 | 37 | 'id' => $children->id, |
38 | 38 | 'text' => $children->name, |
@@ -48,34 +48,34 @@ discard block |
||
48 | 48 | * @param Int $id |
49 | 49 | * @return Product |
50 | 50 | */ |
51 | - public static function getProducts($id = null){ |
|
52 | - if($id === null){ |
|
51 | + public static function getProducts($id = null) { |
|
52 | + if ($id === null) { |
|
53 | 53 | $products = Product::all(); |
54 | - }else{ |
|
54 | + } else { |
|
55 | 55 | $products = Category::find($id)->products; |
56 | 56 | } |
57 | 57 | return $products; |
58 | 58 | } |
59 | 59 | |
60 | - public static function getDetailsFields(Product $product,$product_item_id){ |
|
60 | + public static function getDetailsFields(Product $product, $product_item_id) { |
|
61 | 61 | $element = '<div class="row col">'; |
62 | 62 | |
63 | - foreach($product->details->groupBy('product_detail_id') as $key => $details){ |
|
63 | + foreach ($product->details->groupBy('product_detail_id') as $key => $details) { |
|
64 | 64 | |
65 | - $element.= self::generateDetailHtml(Detail::find($key),$details->groupBy('product_detail_value_id'),$product->id,$product_item_id); |
|
65 | + $element .= self::generateDetailHtml(Detail::find($key), $details->groupBy('product_detail_value_id'), $product->id, $product_item_id); |
|
66 | 66 | } |
67 | - $element.= '<p class="show_error_product" style="color: red; display: none;">Prodotto non disponibile</p>'; |
|
67 | + $element .= '<p class="show_error_product" style="color: red; display: none;">Prodotto non disponibile</p>'; |
|
68 | 68 | $element .= '</div>'; |
69 | 69 | return $element; |
70 | 70 | } |
71 | 71 | |
72 | - public static function generateHtmlField($type,$value,$label){ |
|
73 | - if($type !== 'textarea'){ |
|
72 | + public static function generateHtmlField($type, $value, $label) { |
|
73 | + if ($type !== 'textarea') { |
|
74 | 74 | $html = ''; |
75 | 75 | $html .= "<label>{$label}</label>"; |
76 | 76 | $html .= "<input class='form-control' type='{$type}' value='{$value}'>"; |
77 | 77 | return $html; |
78 | - }else{ |
|
78 | + } else { |
|
79 | 79 | $html = ''; |
80 | 80 | $html .= "<label>{$label}</label>"; |
81 | 81 | $html .= "<textarea class='form-control'>{$value}</textarea>"; |
@@ -83,40 +83,40 @@ discard block |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - public static function getConfigurationFields($product_item_id){ |
|
87 | - $configurationFields = ProductConfigurationField::where('product_item_id',$product_item_id)->get(); |
|
86 | + public static function getConfigurationFields($product_item_id) { |
|
87 | + $configurationFields = ProductConfigurationField::where('product_item_id', $product_item_id)->get(); |
|
88 | 88 | $element = '<div class="col row">'; |
89 | - foreach ($configurationFields as $field){ |
|
90 | - $element .= self::generateHtmlField($field->field->type,$field->value,$field->field->name); |
|
89 | + foreach ($configurationFields as $field) { |
|
90 | + $element .= self::generateHtmlField($field->field->type, $field->value, $field->field->name); |
|
91 | 91 | |
92 | 92 | } |
93 | 93 | $element .= '</div>'; |
94 | 94 | return $element; |
95 | 95 | } |
96 | 96 | |
97 | - public static function buttonCart($product_item_id){ |
|
97 | + public static function buttonCart($product_item_id) { |
|
98 | 98 | return "<button onclick='addToCart(this)' data-product_item_id='{$product_item_id}' class='btn btn-primary mt-3'>Salva nel carrello</button>"; |
99 | 99 | } |
100 | 100 | |
101 | - public static function generateDetailHtml($detail,$values,$product_id,$product_item_id){ |
|
101 | + public static function generateDetailHtml($detail, $values, $product_id, $product_item_id) { |
|
102 | 102 | |
103 | 103 | $type = $detail->type; |
104 | 104 | $html = ''; |
105 | - if($type === 'select'){ |
|
105 | + if ($type === 'select') { |
|
106 | 106 | $html = '<label>'.$detail->name.'</label>'; |
107 | - $html .= '<select onchange="getVariationProduct()" data-product_id="'.$product_id.'" data-detail_id="'.$detail->id .'" class="form-control mongifield_into_product">'; |
|
107 | + $html .= '<select onchange="getVariationProduct()" data-product_id="'.$product_id.'" data-detail_id="'.$detail->id.'" class="form-control mongifield_into_product">'; |
|
108 | 108 | $selected = ''; |
109 | 109 | |
110 | - $details = ProductItemDetail::where('product_item_id',$product_item_id)->get(); |
|
110 | + $details = ProductItemDetail::where('product_item_id', $product_item_id)->get(); |
|
111 | 111 | $filter = []; |
112 | - foreach ($details as $_detail){ |
|
112 | + foreach ($details as $_detail) { |
|
113 | 113 | $filter[$_detail->product_detail_id] = $_detail->product_detail_value_id; |
114 | 114 | } |
115 | - foreach ($values as $detail_value_id =>$value){ |
|
116 | - if(isset($filter[$detail->id])){ |
|
117 | - if($filter[$detail->id] == $detail_value_id){ |
|
115 | + foreach ($values as $detail_value_id =>$value) { |
|
116 | + if (isset($filter[$detail->id])) { |
|
117 | + if ($filter[$detail->id] == $detail_value_id) { |
|
118 | 118 | $selected = 'selected'; |
119 | - }else{ |
|
119 | + } else { |
|
120 | 120 | $selected = ''; |
121 | 121 | } |
122 | 122 | } |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | return $html; |
130 | 130 | } |
131 | 131 | |
132 | - public static function MoveSessionToCart($user_id){ |
|
132 | + public static function MoveSessionToCart($user_id) { |
|
133 | 133 | $user = User::find($user_id); |
134 | 134 | $elements_in_cart = session('cart'); |
135 | - if(!empty($elements_in_cart)){ |
|
136 | - if(Cart::where('user_id',$user->id)->count() <= 0){ |
|
137 | - foreach($elements_in_cart as $product_id => $count){ |
|
135 | + if (!empty($elements_in_cart)) { |
|
136 | + if (Cart::where('user_id', $user->id)->count() <= 0) { |
|
137 | + foreach ($elements_in_cart as $product_id => $count) { |
|
138 | 138 | $cart = new Cart(); |
139 | 139 | $cart->user_id = $user->id; |
140 | 140 | $cart->product_item_id = $product_id; |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | |
15 | 15 | class AdminNewSingleProductController extends Controller |
16 | 16 | { |
17 | - public function page(){ |
|
17 | + public function page() { |
|
18 | 18 | $caregories = Category::all(); |
19 | - return view('mongicommerce::admin.pages.products.new_single_product',['categories' => $caregories]); |
|
19 | + return view('mongicommerce::admin.pages.products.new_single_product', ['categories' => $caregories]); |
|
20 | 20 | } |
21 | 21 | |
22 | - public function createNewSingleProduct(Request $r){ |
|
22 | + public function createNewSingleProduct(Request $r) { |
|
23 | 23 | $r->validate([ |
24 | 24 | 'category_id' => 'required', |
25 | 25 | 'quantity' => 'required', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'image' => 'required', |
28 | 28 | ]); |
29 | 29 | |
30 | - $configuration_fields = json_decode($r->get('configuration_fields'),true); |
|
30 | + $configuration_fields = json_decode($r->get('configuration_fields'), true); |
|
31 | 31 | $quantity = $r->get('quantity'); |
32 | 32 | $price = $r->get('price'); |
33 | 33 | $product_name = $r->get('product_name'); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | $product->image = null; |
44 | 44 | $product->save(); |
45 | 45 | |
46 | - $base64_str = substr($get_image, strpos($get_image, ",")+1); |
|
46 | + $base64_str = substr($get_image, strpos($get_image, ",") + 1); |
|
47 | 47 | $image = base64_decode($base64_str); |
48 | 48 | $destinationPath = public_path().'/uploads/products_img/'.$product->id.'/'.$product->id.'/'; |
49 | 49 | $destinationPathDB = url('/').'/uploads/products_img/'.$product->id.'/'.$product->id.'/'; |
50 | 50 | |
51 | - if(!File::isDirectory($destinationPath)){ |
|
51 | + if (!File::isDirectory($destinationPath)) { |
|
52 | 52 | File::makeDirectory($destinationPath, $mode = 0777, true, true); |
53 | 53 | } |
54 | 54 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $product_item->quantity = $quantity; |
71 | 71 | $product_item->save(); |
72 | 72 | |
73 | - foreach ($configuration_fields as $conf_field){ |
|
73 | + foreach ($configuration_fields as $conf_field) { |
|
74 | 74 | $conf_fields_obj = (object) $conf_field; |
75 | 75 | $configuration_field = new ProductConfigurationField(); |
76 | 76 | $configuration_field->product_item_id = $product_item->id; |
@@ -11,8 +11,8 @@ |
||
11 | 11 | { |
12 | 12 | use HasFactory; |
13 | 13 | |
14 | - public function field(){ |
|
15 | - return $this->belongsTo(ConfigurationField::class,'config_field_id'); |
|
14 | + public function field() { |
|
15 | + return $this->belongsTo(ConfigurationField::class, 'config_field_id'); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | } |
@@ -11,19 +11,19 @@ |
||
11 | 11 | { |
12 | 12 | use HasFactory; |
13 | 13 | |
14 | - public function details(){ |
|
15 | - return $this->hasMany(ProductItemDetail::class,'product_item_id'); |
|
14 | + public function details() { |
|
15 | + return $this->hasMany(ProductItemDetail::class, 'product_item_id'); |
|
16 | 16 | } |
17 | 17 | |
18 | - public function configurationFields(){ |
|
19 | - return $this->hasMany(ProductConfigurationField::class,'product_item_id'); |
|
18 | + public function configurationFields() { |
|
19 | + return $this->hasMany(ProductConfigurationField::class, 'product_item_id'); |
|
20 | 20 | } |
21 | 21 | |
22 | - public function product(){ |
|
22 | + public function product() { |
|
23 | 23 | return $this->belongsTo(Product::class); |
24 | 24 | } |
25 | 25 | |
26 | - public function category(){ |
|
26 | + public function category() { |
|
27 | 27 | return $this->belongsTo(Category::class); |
28 | 28 | } |
29 | 29 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_items', function (Blueprint $table) { |
|
16 | + Schema::create('product_items', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('product_id')->nullable(); |
19 | 19 | $table->unsignedBigInteger('category_id')->nullable(); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('cart', function (Blueprint $table) { |
|
16 | + Schema::create('cart', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('user_id'); |
19 | 19 | $table->unsignedBigInteger('product_item_id'); |
@@ -8,13 +8,13 @@ |
||
8 | 8 | |
9 | 9 | class ShopCheckoutController extends Controller |
10 | 10 | { |
11 | - public function page(){ |
|
11 | + public function page() { |
|
12 | 12 | $note = session('checkout.note_delivery'); |
13 | 13 | $delivery_where = session('checkout.get_in_shop_checkbox'); |
14 | - return view('mongicommerce.pages.checkout',compact('note','delivery_where')); |
|
14 | + return view('mongicommerce.pages.checkout', compact('note', 'delivery_where')); |
|
15 | 15 | } |
16 | 16 | |
17 | - public function saveDetailsInSession(Request $r){ |
|
17 | + public function saveDetailsInSession(Request $r) { |
|
18 | 18 | $note_delivery = $r->get('note_delivery'); |
19 | 19 | $get_in_shop_checkbox = $r->get('get_in_shop_checkbox'); |
20 | 20 | session()->put('checkout.note_delivery', $note_delivery); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | class ShopSummaryController extends Controller |
12 | 12 | { |
13 | - public function page(){ |
|
13 | + public function page() { |
|
14 | 14 | $products = []; |
15 | 15 | $note = session('checkout.note_delivery'); |
16 | 16 | $get_in_shop_checkbox = session('checkout.get_in_shop_checkbox'); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | if (!Auth::check()) { |
19 | 19 | $ids = []; |
20 | 20 | $productsCart = session('cart'); |
21 | - if(isset($productsCart)){ |
|
21 | + if (isset($productsCart)) { |
|
22 | 22 | foreach ($productsCart as $id => $count) { |
23 | 23 | $product = ProductItem::where('id', $id)->first(); |
24 | 24 | $ids[] = $id; |
@@ -51,6 +51,6 @@ discard block |
||
51 | 51 | } |
52 | 52 | $shipping_price = 0; |
53 | 53 | session()->put('checkout.total', $total + $shipping_price); |
54 | - return view('mongicommerce.pages.summary',compact('products','total','shipping_price','note','get_in_shop_checkbox')); |
|
54 | + return view('mongicommerce.pages.summary', compact('products', 'total', 'shipping_price', 'note', 'get_in_shop_checkbox')); |
|
55 | 55 | } |
56 | 56 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | class ShopCartController extends Controller |
12 | 12 | { |
13 | - public function page(){ |
|
13 | + public function page() { |
|
14 | 14 | return view('mongicommerce.pages.cart'); |
15 | 15 | } |
16 | 16 | /** |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | $checkElement = Cart::where('product_item_id', $product->id)->first(); |
25 | 25 | //if is null it means the cart is empty |
26 | 26 | if (is_null($checkElement)) { |
27 | - if($num_avaibile_product > 0){ |
|
27 | + if ($num_avaibile_product > 0) { |
|
28 | 28 | return true; |
29 | - }else{ |
|
29 | + } else { |
|
30 | 30 | return false; |
31 | 31 | } |
32 | - }else{ |
|
32 | + } else { |
|
33 | 33 | //if there is something in the cart check the avaibility |
34 | 34 | if ($checkElement->quantity + 1 <= $num_avaibile_product) { |
35 | 35 | return true; |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | $product = ProductItem::find($product_item_id); |
46 | 46 | $check = $this->checkIfProductAvaible($product); |
47 | 47 | |
48 | - if($check){ |
|
48 | + if ($check) { |
|
49 | 49 | //if i'am not authenticated |
50 | 50 | if (!Auth::check()) { |
51 | 51 | session()->push('products.ids', $product_item_id); |
52 | - session()->put('cart',self::getCountableCart(session('products.ids'))); |
|
52 | + session()->put('cart', self::getCountableCart(session('products.ids'))); |
|
53 | 53 | return response()->json(session('cart')); |
54 | - }else{ |
|
54 | + } else { |
|
55 | 55 | //if number i want is less than number avaible product i can add into cart |
56 | - $mycart = Cart::where('product_item_id',$product->id)->where('user_id',Auth::user()->id)->first(); |
|
57 | - if(is_null($mycart)){ |
|
56 | + $mycart = Cart::where('product_item_id', $product->id)->where('user_id', Auth::user()->id)->first(); |
|
57 | + if (is_null($mycart)) { |
|
58 | 58 | $cart = new Cart(); |
59 | 59 | $cart->user_id = Auth::user()->id; |
60 | 60 | $cart->product_item_id = $product_item_id; |
61 | 61 | $cart->quantity = 1; |
62 | 62 | $cart->save(); |
63 | - }else{ |
|
63 | + } else { |
|
64 | 64 | $mycart->quantity = $mycart->quantity + 1; |
65 | 65 | $mycart->save(); |
66 | 66 | } |
67 | 67 | return true; |
68 | 68 | } |
69 | - }else{ |
|
69 | + } else { |
|
70 | 70 | return response()->json([ |
71 | 71 | 'errors' => "Prodotto non disponibile o terminato", |
72 | 72 | ], 422); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $ids = []; |
123 | 123 | session()->forget('products.ids'); |
124 | 124 | $productsCart = session('cart'); |
125 | - if(isset($productsCart)){ |
|
125 | + if (isset($productsCart)) { |
|
126 | 126 | foreach ($productsCart as $id => $count) { |
127 | 127 | $product = ProductItem::where('id', $id)->first(); |
128 | 128 | $ids[] = $id; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ]; |
137 | 137 | } |
138 | 138 | } |
139 | - session()->put('products.ids',$ids); |
|
139 | + session()->put('products.ids', $ids); |
|
140 | 140 | |
141 | 141 | } else { |
142 | 142 | $productsCart = Cart::where('user_id', Auth::user()->id)->get(); |
@@ -153,26 +153,26 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - return response()->json(['product' => $products , 'total' => self::calculateTotalPrice($products)]); |
|
156 | + return response()->json(['product' => $products, 'total' => self::calculateTotalPrice($products)]); |
|
157 | 157 | } |
158 | 158 | |
159 | - public function incrementOrDecrementElementInCart(Request $r){ |
|
159 | + public function incrementOrDecrementElementInCart(Request $r) { |
|
160 | 160 | $product_id = $r->get('product_id'); |
161 | 161 | $operator = $r->get('operator'); |
162 | 162 | $product = ProductItem::find($product_id); |
163 | 163 | if (!Auth::check()) { |
164 | 164 | $cart = session('cart'); |
165 | 165 | $count_product_in_session = $cart[$product_id]; |
166 | - if($product->quantity > $count_product_in_session || $operator < 0){ |
|
167 | - if($count_product_in_session > 1 || $operator > 0){ |
|
166 | + if ($product->quantity > $count_product_in_session || $operator < 0) { |
|
167 | + if ($count_product_in_session > 1 || $operator > 0) { |
|
168 | 168 | $cart[$product_id] = $count_product_in_session + $operator; |
169 | - session()->put('cart',$cart); |
|
169 | + session()->put('cart', $cart); |
|
170 | 170 | } |
171 | 171 | } |
172 | - }else{ |
|
173 | - $cart = Cart::where('product_item_id',$product_id)->first(); |
|
174 | - if($product->quantity > $cart->quantity || $operator < 0){ |
|
175 | - if($cart->quantity > 1 || $operator > 0){ |
|
172 | + } else { |
|
173 | + $cart = Cart::where('product_item_id', $product_id)->first(); |
|
174 | + if ($product->quantity > $cart->quantity || $operator < 0) { |
|
175 | + if ($cart->quantity > 1 || $operator > 0) { |
|
176 | 176 | $cart->quantity = $cart->quantity + $operator; |
177 | 177 | $cart->save(); |
178 | 178 | } |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | |
182 | 182 | } |
183 | 183 | |
184 | - public function deleteFromCart(Request $r){ |
|
184 | + public function deleteFromCart(Request $r) { |
|
185 | 185 | $product_id = $r->get('product_id'); |
186 | 186 | if (!Auth::check()) { |
187 | 187 | $cart_in_session = session('cart'); |
188 | 188 | unset($cart_in_session[$product_id]); |
189 | - session()->put('cart',$cart_in_session); |
|
190 | - }else{ |
|
191 | - Cart::where('product_item_id',$product_id)->delete(); |
|
189 | + session()->put('cart', $cart_in_session); |
|
190 | + } else { |
|
191 | + Cart::where('product_item_id', $product_id)->delete(); |
|
192 | 192 | return true; |
193 | 193 | } |
194 | 194 | } |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | if (is_null($checkElement)) { |
27 | 27 | if($num_avaibile_product > 0){ |
28 | 28 | return true; |
29 | - }else{ |
|
29 | + } else{ |
|
30 | 30 | return false; |
31 | 31 | } |
32 | - }else{ |
|
32 | + } else{ |
|
33 | 33 | //if there is something in the cart check the avaibility |
34 | 34 | if ($checkElement->quantity + 1 <= $num_avaibile_product) { |
35 | 35 | return true; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | session()->push('products.ids', $product_item_id); |
52 | 52 | session()->put('cart',self::getCountableCart(session('products.ids'))); |
53 | 53 | return response()->json(session('cart')); |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | //if number i want is less than number avaible product i can add into cart |
56 | 56 | $mycart = Cart::where('product_item_id',$product->id)->where('user_id',Auth::user()->id)->first(); |
57 | 57 | if(is_null($mycart)){ |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | $cart->product_item_id = $product_item_id; |
61 | 61 | $cart->quantity = 1; |
62 | 62 | $cart->save(); |
63 | - }else{ |
|
63 | + } else{ |
|
64 | 64 | $mycart->quantity = $mycart->quantity + 1; |
65 | 65 | $mycart->save(); |
66 | 66 | } |
67 | 67 | return true; |
68 | 68 | } |
69 | - }else{ |
|
69 | + } else{ |
|
70 | 70 | return response()->json([ |
71 | 71 | 'errors' => "Prodotto non disponibile o terminato", |
72 | 72 | ], 422); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | session()->put('cart',$cart); |
170 | 170 | } |
171 | 171 | } |
172 | - }else{ |
|
172 | + } else{ |
|
173 | 173 | $cart = Cart::where('product_item_id',$product_id)->first(); |
174 | 174 | if($product->quantity > $cart->quantity || $operator < 0){ |
175 | 175 | if($cart->quantity > 1 || $operator > 0){ |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $cart_in_session = session('cart'); |
188 | 188 | unset($cart_in_session[$product_id]); |
189 | 189 | session()->put('cart',$cart_in_session); |
190 | - }else{ |
|
190 | + } else{ |
|
191 | 191 | Cart::where('product_item_id',$product_id)->delete(); |
192 | 192 | return true; |
193 | 193 | } |