Passed
Push — master ( ebeb83...51d62f )
by Matthijs
08:15
created
src/Services/Product/ProductService.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
  
13 13
 class ProductService extends BaseService
14 14
 {
15
-	public function __construct(ProductRepository $product)
16
-	{
17
-		$this->repo = $product;
15
+    public function __construct(ProductRepository $product)
16
+    {
17
+        $this->repo = $product;
18 18
         $this->storageImagePath = storage_path() .config('hideyo.storage_path'). "/product/";
19 19
         $this->publicImagePath = public_path() .config('hideyo.public_path'). "/product/";
20 20
 
21
-	} 
21
+    } 
22 22
 
23 23
 
24
- /**
24
+    /**
25 25
      * The validation rules for the model.
26 26
      *
27 27
      * @param  integer  $productId id attribute model    
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
     }
483 483
 
484 484
 
485
-  public function increaseAmounts($products)
485
+    public function increaseAmounts($products)
486 486
     {
487 487
         if ($products->count()) {
488 488
             foreach ($products as $product) {
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 
599 599
     public function selectOneByShopIdAndId($shopId, $productId, $attributeId = false)
600 600
     {
601
-       return $this->repo->selectOneByShopIdAndId($shopId, $productId, $attributeId);
601
+        return $this->repo->selectOneByShopIdAndId($shopId, $productId, $attributeId);
602 602
     }
603 603
 
604 604
     public function ajaxProductImages($product, $combinationsIds, $productAttributeId = false) 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 	public function __construct(ProductRepository $product)
16 16
 	{
17 17
 		$this->repo = $product;
18
-        $this->storageImagePath = storage_path() .config('hideyo.storage_path'). "/product/";
19
-        $this->publicImagePath = public_path() .config('hideyo.public_path'). "/product/";
18
+        $this->storageImagePath = storage_path().config('hideyo.storage_path')."/product/";
19
+        $this->publicImagePath = public_path().config('hideyo.public_path')."/product/";
20 20
 
21 21
 	} 
22 22
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             );
52 52
             
53 53
             if ($productId) {
54
-                $rules['title'] =   'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$productId.' = id';
54
+                $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$productId.' = id';
55 55
             }
56 56
         }
57 57
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
             $discountPriceEx = $product->price;
368 368
             $discountTaxRate = 0;
369 369
 
370
-            if($preSaleDiscount) {
370
+            if ($preSaleDiscount) {
371 371
 
372 372
                 if ($preSaleDiscount['value'] AND $preSaleDiscount['collection_id'] == $product->collection_id) {
373 373
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                     $discountTaxRate = $discountPriceInc - $discountPriceEx;                   
384 384
                 }
385 385
 
386
-                if($preSaleDiscount['products']) {
386
+                if ($preSaleDiscount['products']) {
387 387
 
388 388
                     $productIds = array_column($preSaleDiscount['products'], 'id');
389 389
 
@@ -449,11 +449,11 @@  discard block
 block discarded – undo
449 449
         $product = $product->has('productImages')->where('id', '=', $productId)->first();
450 450
         $images = array();
451 451
 
452
-        if($product AND $product->productImages->count()) {  
452
+        if ($product AND $product->productImages->count()) {  
453 453
 
454 454
             $images = $product->productImages()->has('relatedAttributes', '=', 0)->has('relatedProductAttributes', '=', 0)->orderBy('rank', '=', 'asc')->get();
455 455
 
456
-            if($combinationsIds) {
456
+            if ($combinationsIds) {
457 457
 
458 458
                 $imagesRelatedAttributes = $this->getImageModel()->
459 459
                 whereHas('relatedAttributes', function($query) use ($combinationsIds, $product, $productId) { $query->with(array('productImage'))->whereIn('attribute_id', $combinationsIds); });
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 $images = $images->merge($imagesRelatedAttributes)->sortBy('rank');          
462 462
             }
463 463
 
464
-            if($productAttributeId) {                
464
+            if ($productAttributeId) {                
465 465
                 $imagesRelatedProductAttributes = $this->getImageModel()->
466 466
                 whereHas('relatedProductAttributes', function($query) use ($productAttributeId, $product) { $query->where('product_attribute_id', '=', $productAttributeId); })
467 467
                 ->where('product_id', '=', $productId)
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             }
472 472
 
473 473
 
474
-            if(!$images->count()) {
474
+            if (!$images->count()) {
475 475
                 $images = $product->productImages()->orderBy('rank', '=', 'asc')->get();
476 476
             }
477 477
 
Please login to merge, or discard this patch.
src/Services/Product/ProductCombinationService.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             ->where($this->repo->getModel()->getTable().'.product_id', '=', $productId);
22 22
 
23 23
             if (isset($attributes['selected_attribute_ids'])) {
24
-                $check->where(function ($query) use ($attributes) {
24
+                $check->where(function($query) use ($attributes) {
25 25
                     $query->whereIn($this->repo->getModelAttributeCombination()->getTable().'.attribute_id', $attributes['selected_attribute_ids']);
26 26
                 });
27 27
             }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             ->where($this->repo->getModel()->getTable().'.product_id', '=', $attributes['product_id']);
93 93
 
94 94
             if (isset($attributes['selected_attribute_ids'])) {
95
-                $check->where(function ($query) use ($attributes) {
95
+                $check->where(function($query) use ($attributes) {
96 96
                     $query->whereIn($this->repo->getModelAttributeCombination()->getTable().'.attribute_id', $attributes['selected_attribute_ids']);
97 97
                 });
98 98
             }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                     $newData[$row['product_attribute_id']] = $row->productAttribute->combinations->toArray();
105 105
                 }
106 106
 
107
-                if(isset($attributes['selected_attribute_ids'])) {
107
+                if (isset($attributes['selected_attribute_ids'])) {
108 108
                 foreach ($newData as $row) {
109 109
                     if (count($row) == count($attributes['selected_attribute_ids'])) {
110 110
                         $i = 0;
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
             }
163 163
         }
164 164
 
165
-        if(!$productAttributeId AND $attributeLeadingGroup AND isset($newPullDowns[$attributeLeadingGroup->title])) {
165
+        if (!$productAttributeId AND $attributeLeadingGroup AND isset($newPullDowns[$attributeLeadingGroup->title])) {
166 166
             $productAttributeId = key($newPullDowns[$attributeLeadingGroup->title]);
167 167
         }
168 168
 
169
-        $productAttributeResultWithAttributeId =  $this->repo->getProductAttribute($product, $productAttributeId);   
169
+        $productAttributeResultWithAttributeId = $this->repo->getProductAttribute($product, $productAttributeId);   
170 170
 
171 171
         if ($productAttributeResultWithAttributeId->get()->first()) {
172 172
             foreach ($productAttributeResultWithAttributeId->get()->first()->combinations as $combination) {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
  
10 10
 class ProductCombinationService extends BaseService
11 11
 {
12
-	public function __construct(ProductCombinationRepository $productTagGroup)
13
-	{
14
-		$this->repo = $productTagGroup;
15
-	} 
12
+    public function __construct(ProductCombinationRepository $productTagGroup)
13
+    {
14
+        $this->repo = $productTagGroup;
15
+    } 
16 16
 
17
-   public function create(array $attributes, $productId)
17
+    public function create(array $attributes, $productId)
18 18
 {
19 19
         if (isset($attributes['selected_attribute_ids'])) {
20 20
             $check = $this->repo->getModelAttributeCombination()->leftJoin($this->repo->getModel()->getTable(), $this->repo->getModel()->getTable().'.id', '=', $this->repo->getModelAttributeCombination()->getTable().'.product_attribute_id')
@@ -180,9 +180,9 @@  discard block
 block discarded – undo
180 180
     }
181 181
 
182 182
 
183
-	public function selectAllByProductCategoryId($productCategoryId, $shopId) {
184
-		return $this->repo->selectAllByProductCategoryId($productCategoryId, $shopId);
185
-	}
183
+    public function selectAllByProductCategoryId($productCategoryId, $shopId) {
184
+        return $this->repo->selectAllByProductCategoryId($productCategoryId, $shopId);
185
+    }
186 186
 
187 187
     public function generatePulldowns($product, $productAttributeId, $attributeLeadingGroup = false, $secondAttributeId = false) 
188 188
     {
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductWaitingListRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
         );
32 32
         
33 33
         if ($waitingListId) {
34
-            $rules['tag'] =   'required|between:4,65|unique_with:'.$this->model->getTable().', shop_id, '.$waitingListId.' = id';
34
+            $rules['tag'] = 'required|between:4,65|unique_with:'.$this->model->getTable().', shop_id, '.$waitingListId.' = id';
35 35
         }
36 36
 
37 37
         return $rules;
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductAttributeCombination.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     protected $table = 'product_attribute_combination';
15 15
 
16 16
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
17
-    protected $fillable = ['product_attribute_id', 'attribute_id',  'modified_by_user_id'];
17
+    protected $fillable = ['product_attribute_id', 'attribute_id', 'modified_by_user_id'];
18 18
 
19 19
     public function attribute()
20 20
     {
Please login to merge, or discard this patch.
src/Services/Product/Entity/Product.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
             if ($this->discount_value) {
104 104
                 if ($this->discount_type == 'amount') {
105 105
                     $discountPriceInc = $priceInc - $this->discount_value;
106
-                     $discountPriceEx = $discountPriceInc / 1.21;
106
+                        $discountPriceEx = $discountPriceInc / 1.21;
107 107
                 } elseif ($this->discount_type == 'percent') {
108 108
                     $tax = ($this->discount_value / 100) * $priceInc;
109 109
                     $discountPriceInc = $priceInc - $tax;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
183 183
 
184 184
     public function relatedProductsActive()
185 185
     {
186
-        return $this->belongsToMany('Hideyo\Ecommerce\Framework\Services\Product\Entity\Product', 'product_related_product', 'product_id', 'related_product_id')->whereHas('productCategory', function ($query) {
186
+        return $this->belongsToMany('Hideyo\Ecommerce\Framework\Services\Product\Entity\Product', 'product_related_product', 'product_id', 'related_product_id')->whereHas('productCategory', function($query) {
187 187
             $query->where('active', '=', '1');
188 188
         })->where('product.active', '=', '1');
189 189
     }
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductAmountSeries.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     protected $table = 'product_amount_series';
16 16
 
17 17
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
18
-    protected $fillable = ['active', 'product_id',  'series_value', 'series_start', 'series_max', 'modified_by_user_id'];
18
+    protected $fillable = ['active', 'product_id', 'series_value', 'series_start', 'series_max', 'modified_by_user_id'];
19 19
 
20 20
     public function product()
21 21
     {
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductRelatedProductRepository.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,6 @@
 block discarded – undo
19 19
   
20 20
     function selectAllByProductId($productId)
21 21
     {
22
-         return $this->model->where('product_id', '=', $productId)->get();
22
+            return $this->model->where('product_id', '=', $productId)->get();
23 23
     }   
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductAmountOption.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     protected $table = 'product_amount_option';
16 16
 
17 17
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
18
-    protected $fillable = ['product_id',  'amount', 'discount_type', 'discount_value', 'discount_start_date', 'discount_end_date', 'modified_by_user_id'];
18
+    protected $fillable = ['product_id', 'amount', 'discount_type', 'discount_value', 'discount_start_date', 'discount_end_date', 'modified_by_user_id'];
19 19
 
20 20
 
21 21
 
Please login to merge, or discard this patch.
src/Services/Product/Entity/ProductImage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     protected $table = 'product_image';
15 15
 
16 16
     // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model.
17
-    protected $fillable = ['product_id', 'product_variation_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'shop_id', 'modified_by_user_id',];
17
+    protected $fillable = ['product_id', 'product_variation_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'shop_id', 'modified_by_user_id', ];
18 18
 
19 19
     public function product()
20 20
     {
Please login to merge, or discard this patch.