Test Failed
Push — master ( 21aadb...bb97ee )
by Gianluca
09:23 queued 02:55
created
src/Http/Controllers/admin/AdminNewProductController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 
14 14
 class AdminNewProductController extends Controller
15 15
 {
16
-    public function page(){
16
+    public function page() {
17 17
         return view('mongicommerce::admin.pages.products.new_product');
18 18
     }
19 19
 
20
-    public function createNewProduct(Request $r){
20
+    public function createNewProduct(Request $r) {
21 21
 
22 22
         $r->validate([
23 23
             'product_name' => 'required',
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
         $product->category_id = $category_id;
39 39
         $product->save();
40 40
 
41
-        $base64_str = substr($get_image, strpos($get_image, ",")+1);
41
+        $base64_str = substr($get_image, strpos($get_image, ",") + 1);
42 42
         $image = base64_decode($base64_str);
43 43
         $destinationPath = public_path().'/uploads/products_img/'.$product->id.'/';
44 44
         $destinationPathDB = url('/').'/uploads/products_img/'.$product->id.'/';
45 45
 
46
-        if(!File::isDirectory($destinationPath)){
46
+        if (!File::isDirectory($destinationPath)) {
47 47
             File::makeDirectory($destinationPath, $mode = 0777, true, true);
48 48
         }
49 49
         $image_name = time().'.'.'jpeg';
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopSingleProductController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@
 block discarded – undo
13 13
 
14 14
 class ShopSingleProductController extends Controller
15 15
 {
16
-     public function page($id,$product_item_id = null){
16
+     public function page($id, $product_item_id = null) {
17 17
          $product = Product::find($id);
18
-         if($product_item_id == null){
19
-             return redirect()->route('shop.single.product',[$product->id,$product->items->first()->id]);
18
+         if ($product_item_id == null) {
19
+             return redirect()->route('shop.single.product', [$product->id, $product->items->first()->id]);
20 20
          }
21
-         $details_fields = Template::getDetailsFields($product,$product_item_id);
21
+         $details_fields = Template::getDetailsFields($product, $product_item_id);
22 22
          $configuration_fields = Template::getConfigurationFields($product_item_id);
23 23
          $btn_cart = Template::buttonCart($product_item_id);
24 24
 
25 25
 
26
-         return view('mongicommerce.pages.single-product',compact('product','details_fields','configuration_fields','btn_cart'));
26
+         return view('mongicommerce.pages.single-product', compact('product', 'details_fields', 'configuration_fields', 'btn_cart'));
27 27
      }
28 28
 }
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminNewSingleProductController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Models/ProductConfigurationField.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Models/ProductItem.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
database/migrations/2020_12_02_085340_create_product_items_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
database/migrations/2020_12_02_091246_create_cart_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopCheckoutController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Http/Controllers/shop/ShopSummaryController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.