Passed
Push — master ( ebeb83...51d62f )
by Matthijs
08:15
created
src/Services/Product/Entity/ProductCombinationRepository.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 
40 40
     function selectOneByShopIdAndSlug($shopId, $slug)
41 41
     {
42
-           return $this->model->with(array('productCategory', 'productImages'))->get()->first();
42
+            return $this->model->with(array('productCategory', 'productImages'))->get()->first();
43 43
     }
44 44
 
45 45
     function selectOneByShopIdAndId($shopId, $productAttributeId)
46 46
     {
47
-           return $this->model->with(array('productCategory', 'productImages'))->where('id', '=', $productAttributeId)->get()->first();
47
+            return $this->model->with(array('productCategory', 'productImages'))->where('id', '=', $productAttributeId)->get()->first();
48 48
     }
49 49
     
50 50
 
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function selectAllByProductCategoryId($productCategoryId, $shopId)
69 69
     {
70
-         return $this->model->
71
-         whereHas('product', function ($query) use ($productCategoryId, $shopId) {
70
+            return $this->model->
71
+            whereHas('product', function ($query) use ($productCategoryId, $shopId) {
72 72
             $query->where('product_category_id', '=', $productCategoryId);
73 73
             $query->where('active', 1);
74 74
             $query->where('shop_id', $shopId);
75
-         })->with(array('combinations' => function ($q) {
75
+            })->with(array('combinations' => function ($q) {
76 76
             $q->with(array('attribute' => function ($q) {
77 77
                 $q->with(array('attributeGroup'));
78 78
             }));
79
-         }))->get();
79
+            }))->get();
80 80
     }
81 81
 
82 82
     public function increaseAmounts($products)
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     function getProductAttribute($product, $productAttributeId, $secondAttributeId = false) {   
117
-       $productAttribute = $this->model->where('product_id', '=', $product->id)
117
+        $productAttribute = $this->model->where('product_id', '=', $product->id)
118 118
         ->whereHas('combinations', function ($query) use ($productAttributeId, $secondAttributeId) {
119 119
             if ($productAttributeId) {
120 120
                 $query->where('attribute_id', '=', $productAttributeId);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function selectAllByShopIdAndProductId($shopId, $productId)
32 32
     {
33
-        return $this->model->select('id')->where('product_id', '=', $productId)->with(array('combinations' => function ($query) {
34
-            $query->with(array('attribute' => function ($query) {
33
+        return $this->model->select('id')->where('product_id', '=', $productId)->with(array('combinations' => function($query) {
34
+            $query->with(array('attribute' => function($query) {
35 35
                 $query->with(array('attributeGroup'));
36 36
             }));
37 37
         }))->get();
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     public function selectAllByProductCategoryId($productCategoryId, $shopId)
69 69
     {
70 70
          return $this->model->
71
-         whereHas('product', function ($query) use ($productCategoryId, $shopId) {
71
+         whereHas('product', function($query) use ($productCategoryId, $shopId) {
72 72
             $query->where('product_category_id', '=', $productCategoryId);
73 73
             $query->where('active', 1);
74 74
             $query->where('shop_id', $shopId);
75
-         })->with(array('combinations' => function ($q) {
76
-            $q->with(array('attribute' => function ($q) {
75
+         })->with(array('combinations' => function($q) {
76
+            $q->with(array('attribute' => function($q) {
77 77
                 $q->with(array('attributeGroup'));
78 78
             }));
79 79
          }))->get();
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
 
116 116
     function getProductAttribute($product, $productAttributeId, $secondAttributeId = false) {   
117 117
        $productAttribute = $this->model->where('product_id', '=', $product->id)
118
-        ->whereHas('combinations', function ($query) use ($productAttributeId, $secondAttributeId) {
118
+        ->whereHas('combinations', function($query) use ($productAttributeId, $secondAttributeId) {
119 119
             if ($productAttributeId) {
120 120
                 $query->where('attribute_id', '=', $productAttributeId);
121 121
             }
122 122
         })
123
-        ->whereHas('combinations', function ($query) use ($secondAttributeId) {
123
+        ->whereHas('combinations', function($query) use ($secondAttributeId) {
124 124
             if ($secondAttributeId) {
125 125
                 $query->where('attribute_id', '=', $secondAttributeId);
126 126
             }
127 127
         })
128
-        ->with(array('combinations' => function ($query) {
129
-            $query->with(array('attribute' => function ($query) {
128
+        ->with(array('combinations' => function($query) {
129
+            $query->with(array('attribute' => function($query) {
130 130
                 $query->with(array('attributeGroup'));
131 131
             }));
132 132
         }))        
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductAmountOptionRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         );
30 30
         
31 31
         if ($AmountOptionId) {
32
-            $rules['amount'] =   'required';
32
+            $rules['amount'] = 'required';
33 33
         }
34 34
 
35 35
         return $rules;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     function selectOneByShopIdAndId($shopId, $AmountOptionId)
82 82
     {
83
-        $result = $this->model->with(array('relatedPaymentMethods' => function ($query) {
83
+        $result = $this->model->with(array('relatedPaymentMethods' => function($query) {
84 84
             $query->where('active', 1);
85 85
         }))->where('shop_id', $shopId)->where('active', 1)->where('id', '=', $AmountOptionId)->get();
86 86
         
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductExtraFieldValueRepository.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@
 block discarded – undo
30 30
 
31 31
     function selectOneByShopIdAndSlug($shopId, $slug)
32 32
     {
33
-           return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('slug', $slug)->get()->first();
33
+            return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('slug', $slug)->get()->first();
34 34
     }
35 35
 
36 36
     function selectOneByShopIdAndId($shopId, $id)
37 37
     {
38
-           return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('id', $id)->get()->first();
38
+            return $this->model->with(array('productCategory', 'productImages'))->where('shop_id', $shopId)->where('id', $id)->get()->first();
39 39
     }
40 40
 
41 41
     function selectAllByProductCategoryId($productCategoryId, $shopId)
42 42
     {
43 43
 
44
-         return $this->model->
45
-         whereHas('product', function ($query) use ($productCategoryId, $shopId) {
44
+            return $this->model->
45
+            whereHas('product', function ($query) use ($productCategoryId, $shopId) {
46 46
             $query->where('product_category_id', '=', $productCategoryId);
47 47
             $query->where('active', 1);
48 48
             $query->where('shop_id', $shopId);
49
-         })->with(
50
-             array(
49
+            })->with(
50
+                array(
51 51
                 'extraFieldDefaultValue',
52 52
                 'extraField' => function ($q) {
53 53
                 }
54 54
                 )
55
-         )->get();
55
+            )->get();
56 56
     }
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,14 +42,14 @@
 block discarded – undo
42 42
     {
43 43
 
44 44
          return $this->model->
45
-         whereHas('product', function ($query) use ($productCategoryId, $shopId) {
45
+         whereHas('product', function($query) use ($productCategoryId, $shopId) {
46 46
             $query->where('product_category_id', '=', $productCategoryId);
47 47
             $query->where('active', 1);
48 48
             $query->where('shop_id', $shopId);
49 49
          })->with(
50 50
              array(
51 51
                 'extraFieldDefaultValue',
52
-                'extraField' => function ($q) {
52
+                'extraField' => function($q) {
53 53
                 }
54 54
                 )
55 55
          )->get();
Please login to merge, or discard this patch.
src/Services/News/Entity/NewsRepository.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
     public function selectAllGroups()
296 296
     {
297
-       return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get();
297
+        return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get();
298 298
     }
299 299
 
300 300
     public function findGroup($groupId)
@@ -325,12 +325,12 @@  discard block
 block discarded – undo
325 325
 
326 326
     function selectAllByBlogCategoryId($newsCategoryId)
327 327
     {
328
-           return $this->model->with(array('extraFields' => function ($query) {
329
-           }, 'taxRate', 'newsCategory',  'relatedBlogs' => function ($query) {
328
+            return $this->model->with(array('extraFields' => function ($query) {
329
+            }, 'taxRate', 'newsCategory',  'relatedBlogs' => function ($query) {
330 330
             $query->with('newsImages')->orderBy('rank', 'asc');
331
-           }, 'newsImages' => function ($query) {
331
+            }, 'newsImages' => function ($query) {
332 332
             $query->orderBy('rank', 'asc');
333
-           }))->where('active', 1)->where('news_category_id', '=', $newsCategoryId)->get();
333
+            }))->where('active', 1)->where('news_category_id', '=', $newsCategoryId)->get();
334 334
     }
335 335
 
336 336
     function selectOneById($shopId, $slug)
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 
345 345
     function selectAllActiveGroupsByShopId($shopId)
346 346
     {
347
-         return $this->modelGroup->where('shop_id', $shopId)->where('active', 1)->get();
347
+            return $this->modelGroup->where('shop_id', $shopId)->where('active', 1)->get();
348 348
     }
349 349
 
350 350
     function selectOneGroupByShopIdAndSlug($shopId, $slug)
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
     {
377 377
         $dt = Carbon::now('Europe/Amsterdam');
378 378
 
379
-           $result = $this->model
380
-           ->where('shop_id', $shopId)
381
-           ->where('published_at', '<=', $dt->toDateString('Y-m-d'));
379
+            $result = $this->model
380
+            ->where('shop_id', $shopId)
381
+            ->where('published_at', '<=', $dt->toDateString('Y-m-d'));
382 382
 
383 383
             return array(
384 384
                 'totals' => $result->get()->count(),
@@ -392,12 +392,12 @@  discard block
 block discarded – undo
392 392
     {
393 393
         $dt = Carbon::now('Europe/Amsterdam');
394 394
 
395
-           $result = $this->model
396
-           ->where('shop_id', $shopId)
397
-           ->where('published_at', '<=', $dt->toDateString('Y-m-d'))
398
-           ->whereHas('newsGroup', function ($query) use ($newsGroupSlug) {
395
+            $result = $this->model
396
+            ->where('shop_id', $shopId)
397
+            ->where('published_at', '<=', $dt->toDateString('Y-m-d'))
398
+            ->whereHas('newsGroup', function ($query) use ($newsGroupSlug) {
399 399
             $query->where('slug', '=', $newsGroupSlug);
400
-           });
400
+            });
401 401
 
402 402
             return array(
403 403
                 'totals' => $result->get()->count(),
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
         $this->model = $model;
29 29
         $this->modelImage = $modelImage;
30 30
         $this->modelGroup = $modelGroup;
31
-        $this->storageImagePath = storage_path() .config('hideyo.storage_path'). "/news/";
32
-        $this->publicImagePath = public_path() .config('hideyo.public_path'). "/news/";
31
+        $this->storageImagePath = storage_path().config('hideyo.storage_path')."/news/";
32
+        $this->publicImagePath = public_path().config('hideyo.public_path')."/news/";
33 33
     }
34 34
   
35 35
     /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             );
51 51
             
52 52
             if ($newsId) {
53
-                $rules['title'] =   'required|between:4,65|unique:'.$this->model->getTable().',title,'.$newsId;
53
+                $rules['title'] = 'required|between:4,65|unique:'.$this->model->getTable().',title,'.$newsId;
54 54
             }
55 55
         }
56 56
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             );
70 70
             
71 71
             if ($newsGroupId) {
72
-                $rules['title'] =   'required|between:4,65|unique:'.$this->modelGroup->getTable().',title,'.$newsGroupId;
72
+                $rules['title'] = 'required|between:4,65|unique:'.$this->modelGroup->getTable().',title,'.$newsGroupId;
73 73
             }
74 74
         }
75 75
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             return $validator;
128 128
         } 
129 129
 
130
-        $filename =  str_replace(" ", "_", strtolower($attributes['file']->getClientOriginalName()));
130
+        $filename = str_replace(" ", "_", strtolower($attributes['file']->getClientOriginalName()));
131 131
         $uploadSuccess = $attributes['file']->move($destinationPath, $filename);
132 132
 
133 133
         if ($uploadSuccess) {
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
 
193 193
                         if (!File::exists($this->publicImagePath.$valueImage."/".$productImage->news_id."/".$productImage->file)) {
194 194
                             if (File::exists($this->storageImagePath.$productImage->news_id."/".$productImage->file)) {
195
-                                $image = Image::make(storage_path() .config('hideyo.storage_path'). "//news/".$productImage->news_id."/".$productImage->file);
195
+                                $image = Image::make(storage_path().config('hideyo.storage_path')."//news/".$productImage->news_id."/".$productImage->file);
196 196
                                 $explode = explode('x', $valueImage);
197 197
                                 $image->fit($explode[0], $explode[1]);
198 198
                             
199 199
                                 $image->interlace();
200 200
 
201
-                                $image->save(public_path() .config('hideyo.storage_path'). "/news/".$valueImage."/".$productImage->news_id."/".$productImage->file);
201
+                                $image->save(public_path().config('hideyo.storage_path')."/news/".$valueImage."/".$productImage->news_id."/".$productImage->file);
202 202
                             }
203 203
                         }
204 204
                     }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             }
258 258
         }
259 259
 
260
-        $directory = app_path() . "/storage/files/news/".$this->model->id;
260
+        $directory = app_path()."/storage/files/news/".$this->model->id;
261 261
         File::deleteDirectory($directory);
262 262
 
263 263
         return $this->model->delete();
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 
326 326
     function selectAllByBlogCategoryId($newsCategoryId)
327 327
     {
328
-           return $this->model->with(array('extraFields' => function ($query) {
329
-           }, 'taxRate', 'newsCategory',  'relatedBlogs' => function ($query) {
328
+           return $this->model->with(array('extraFields' => function($query) {
329
+           }, 'taxRate', 'newsCategory', 'relatedBlogs' => function($query) {
330 330
             $query->with('newsImages')->orderBy('rank', 'asc');
331
-           }, 'newsImages' => function ($query) {
331
+           }, 'newsImages' => function($query) {
332 332
             $query->orderBy('rank', 'asc');
333 333
            }))->where('active', 1)->where('news_category_id', '=', $newsCategoryId)->get();
334 334
     }
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
     function selectOneById($shopId, $slug)
337 337
     {
338 338
         $dt = Carbon::now('Europe/Amsterdam');
339
-        $result = $this->model->with(array('newsCategory', 'relatedBlogs', 'newsImages' => function ($query) {
339
+        $result = $this->model->with(array('newsCategory', 'relatedBlogs', 'newsImages' => function($query) {
340 340
             $query->orderBy('rank', 'asc');
341 341
         }))->where('published_at', '<=', $dt->toDateString('Y-m-d'))->where('active', 1)->where('id', $id)->get()->first();
342 342
         return $result;
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
         $dt = Carbon::now('Europe/Amsterdam');
363 363
 
364 364
         return $this->model->with(
365
-            array('newsImages' => function ($query) {
365
+            array('newsImages' => function($query) {
366 366
                 $query->orderBy('rank', 'asc');
367 367
             })
368 368
         )
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
            $result = $this->model
396 396
            ->where('shop_id', $shopId)
397 397
            ->where('published_at', '<=', $dt->toDateString('Y-m-d'))
398
-           ->whereHas('newsGroup', function ($query) use ($newsGroupSlug) {
398
+           ->whereHas('newsGroup', function($query) use ($newsGroupSlug) {
399 399
             $query->where('slug', '=', $newsGroupSlug);
400 400
            });
401 401
 
Please login to merge, or discard this patch.
src/Services/Shop/ShopService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
     public function __construct(ShopRepository $shop)
14 14
     {
15 15
         $this->repo = $shop;
16
-        $this->storageImagePath = storage_path() .config('hideyo.storage_path'). "/shop/";
17
-        $this->publicImagePath = public_path() .config('hideyo.public_path'). "/shop/";
16
+        $this->storageImagePath = storage_path().config('hideyo.storage_path')."/shop/";
17
+        $this->publicImagePath = public_path().config('hideyo.public_path')."/shop/";
18 18
     } 
19 19
 
20 20
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         );
32 32
 
33 33
         if ($shopId) {
34
-            $rules['title'] =   $rules['title'].',title,'.$shopId;
34
+            $rules['title'] = $rules['title'].',title,'.$shopId;
35 35
         }
36 36
 
37 37
         return $rules;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         
49 49
         if (isset($attributes['logo'])) {
50 50
             $destinationPath = $this->storageImagePath.$model->id;
51
-            $filename =  str_replace(" ", "_", strtolower($attributes['logo']->getClientOriginalName()));
51
+            $filename = str_replace(" ", "_", strtolower($attributes['logo']->getClientOriginalName()));
52 52
             $upload_success = $attributes['logo']->move($destinationPath, $filename);
53 53
 
54 54
             $attributes['logo_file_name'] = $filename;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 File::delete($model->logo_file_path);
91 91
                 $destinationPath = $this->storageImagePath.$model->id;
92 92
 
93
-                $filename =  str_replace(" ", "_", strtolower($attributes['logo']->getClientOriginalName()));
93
+                $filename = str_replace(" ", "_", strtolower($attributes['logo']->getClientOriginalName()));
94 94
                 $upload_success = $attributes['logo']->move($destinationPath, $filename);
95 95
 
96 96
                 $attributes['logo_file_name'] = $filename;
Please login to merge, or discard this patch.
src/Services/BaseRepository.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Hideyo\Ecommerce\Framework\Services;
3 3
 
4
- class BaseRepository 
4
+    class BaseRepository 
5 5
 {
6 6
     /**
7 7
      * Select all model items
8 8
      * @return object|null
9 9
      */
10
-	public function selectAll()
11
-	{
12
-	    return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get();
13
-	}
10
+    public function selectAll()
11
+    {
12
+        return $this->model->where('shop_id', auth('hideyobackend')->user()->selected_shop_id)->get();
13
+    }
14 14
 
15 15
     /**
16 16
      * select all models by shop id
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function selectAllByShopId($shopId)
21 21
     {
22
-         return $this->model->where('shop_id', $shopId)->get();
22
+            return $this->model->where('shop_id', $shopId)->get();
23 23
     }
24 24
 
25 25
     /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public function selectAllActiveByShopId($shopId)
31 31
     {
32
-         return $this->model->where('shop_id', $shopId)->where('active', 1)->get();
32
+            return $this->model->where('shop_id', $shopId)->where('active', 1)->get();
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.
src/Services/BaseService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     {
70 70
         if (isset($result->id)) {
71 71
             flash($successMsg);
72
-            if(is_array($routeName)) {
72
+            if (is_array($routeName)) {
73 73
                 return redirect()->route($routeName[0], $routeName[1]);
74 74
             }
75 75
             return redirect()->route($routeName);   
Please login to merge, or discard this patch.