Test Failed
Push — master ( a4b299...6cd9b3 )
by Gianluca
15:28
created
src/Http/Controllers/shop/ShopCartController.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
         if (is_null($checkElement)) {
26 26
             if($num_avaibile_product > 0){
27 27
                 return true;
28
-            }else{
28
+            } else{
29 29
                 return false;
30 30
             }
31
-        }else{
31
+        } else{
32 32
             //if there is something in the cart check the avaibility
33 33
             if ($checkElement->quantity + 1 <= $num_avaibile_product) {
34 34
                 return true;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                 session()->push('products.ids', $product_item_id);
51 51
                 session()->put('cart',self::getCountableCart(session('products.ids')));
52 52
                 return response()->json(session('cart'));
53
-            }else{
53
+            } else{
54 54
                 //if number i want is less than number avaible product i can add into cart
55 55
                 $mycart = Cart::where('product_item_id',$product->id)->where('user_id',Auth::user()->id)->first();
56 56
                 if(is_null($mycart)){
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
                     $cart->product_item_id = $product_item_id;
60 60
                     $cart->quantity = 1;
61 61
                     $cart->save();
62
-                }else{
62
+                } else{
63 63
                     $mycart->quantity = $mycart->quantity + 1;
64 64
                     $mycart->save();
65 65
                 }
66 66
                 return true;
67 67
             }
68
-        }else{
68
+        } else{
69 69
             return response()->json([
70 70
                 'errors' => "Prodotto non disponibile o terminato",
71 71
             ], 422);
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopSingleProductController.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@
 block discarded – undo
7 7
 
8 8
 class ShopSingleProductController extends Controller
9 9
 {
10
-     public function page($id,$product_item_id = null){
11
-         $product = Product::find($id);
12
-         if($product_item_id == null){
13
-             return redirect()->route('shop.single.product',[$product->id,$product->items->first()->id]);
14
-         }
15
-         $details_fields = Template::getDetailsFields($product,$product_item_id);
16
-         $configuration_fields = Template::getConfigurationFields($product_item_id);
17
-         $btn_cart = Template::buttonCart($product_item_id);
18
-         return view('mongicommerce.pages.single-product',compact('product','details_fields','configuration_fields','btn_cart'));
19
-     }
10
+        public function page($id,$product_item_id = null){
11
+            $product = Product::find($id);
12
+            if($product_item_id == null){
13
+                return redirect()->route('shop.single.product',[$product->id,$product->items->first()->id]);
14
+            }
15
+            $details_fields = Template::getDetailsFields($product,$product_item_id);
16
+            $configuration_fields = Template::getConfigurationFields($product_item_id);
17
+            $btn_cart = Template::buttonCart($product_item_id);
18
+            return view('mongicommerce.pages.single-product',compact('product','details_fields','configuration_fields','btn_cart'));
19
+        }
20 20
 }
Please login to merge, or discard this patch.