Passed
Push — master ( 15fb0b...7beac6 )
by Matthijs
01:41
created
src/Services/Cart/ItemAttributeCollection.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
     public function __get($name)
10 10
     {
11
-        if( $this->has($name) ) return $this->get($name);
11
+        if ($this->has($name)) return $this->get($name);
12 12
         return null;
13 13
     }
14 14
 }
15 15
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 
9 9
     public function __get($name)
10 10
     {
11
-        if( $this->has($name) ) return $this->get($name);
11
+        if( $this->has($name) ) {
12
+            return $this->get($name);
13
+        }
12 14
         return null;
13 15
     }
14 16
 }
15 17
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/Cart/Cart.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -594,7 +594,6 @@
 block discarded – undo
594 594
     /**
595 595
      * get the cart voucher
596 596
      *
597
-
598 597
      */
599 598
     public function getVoucher()
600 599
     {
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
         $this->events = $events;
65 65
         $this->session = $session;
66 66
         $this->instanceName = $instanceName;
67
-        $this->sessionKeyCartItems = $session_key . '_cart_items';
68
-        $this->sessionKeyCartConditions = $session_key . '_cart_conditions';
69
-        $this->sessionKeyCartVoucher = $session_key . '_voucher';
67
+        $this->sessionKeyCartItems = $session_key.'_cart_items';
68
+        $this->sessionKeyCartConditions = $session_key.'_cart_conditions';
69
+        $this->sessionKeyCartVoucher = $session_key.'_voucher';
70 70
         $this->fireEvent('created');
71 71
         $this->config = $config;
72 72
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function update($id, $data)
153 153
     {
154
-        if($this->fireEvent('updating', $data) === false) {
154
+        if ($this->fireEvent('updating', $data) === false) {
155 155
             return false;
156 156
         }
157 157
         $cart = $this->getContent();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     protected function addRow($id, $item)
249 249
     {
250
-        if($this->fireEvent('adding', $item) === false) {
250
+        if ($this->fireEvent('adding', $item) === false) {
251 251
             return false;
252 252
         }
253 253
         $cart = $this->getContent();
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $condition->setOrder(!is_null($last) ? $last->getOrder() + 1 : 1);
281 281
         }
282 282
         $conditions->put($condition->getName(), $condition);
283
-        $conditions = $conditions->sortBy(function ($condition, $key) {
283
+        $conditions = $conditions->sortBy(function($condition, $key) {
284 284
             return $condition->getOrder();
285 285
         });
286 286
         $this->saveConditions($conditions);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function getConditionsByType($type)
320 320
     {
321
-        return $this->getConditions()->filter(function (CartCondition $condition) use ($type) {
321
+        return $this->getConditions()->filter(function(CartCondition $condition) use ($type) {
322 322
             return $condition->getType() == $type;
323 323
         });
324 324
     }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      */
334 334
     public function removeConditionsByType($type)
335 335
     {
336
-        $this->getConditionsByType($type)->each(function ($condition) {
336
+        $this->getConditionsByType($type)->each(function($condition) {
337 337
             $this->removeCartCondition($condition->getName());
338 338
         });
339 339
     }
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
     public function getSubTotalWithoutConditions($formatted = true)
445 445
     {
446 446
         $cart = $this->getContent();
447
-        $sum = $cart->sum(function ($item) {
447
+        $sum = $cart->sum(function($item) {
448 448
             return $item->getOriginalPriceWithTaxSum();
449 449
         });
450 450
 
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
     public function getSubTotalWithTax($formatted = true)
460 460
     {
461 461
         $cart = $this->getContent();
462
-        $sum = $cart->sum(function ($item) {
462
+        $sum = $cart->sum(function($item) {
463 463
             return $item->getOriginalPriceWithTaxSum(false);
464 464
         });
465 465
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
     public function getSubTotalWithoutTax($formatted = true)
476 476
     {
477 477
         $cart = $this->getContent();
478
-        $sum = $cart->sum(function ($item) {
478
+        $sum = $cart->sum(function($item) {
479 479
             return $item->getOriginalPriceWithoutTaxSum(false);
480 480
         });
481 481
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
         $process = 0;
496 496
         $conditions = $this
497 497
             ->getConditions()
498
-            ->filter(function ($cond) {
498
+            ->filter(function($cond) {
499 499
                 return $cond->getTarget() === 'subtotal';
500 500
             });
501 501
         // if no conditions were added, just return the sub total
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
             return Helpers::formatValue(floatval($subTotal), $formatted, $this->config);
504 504
         }
505 505
         $conditions
506
-            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) {
506
+            ->each(function($cond) use ($subTotal, &$newTotal, &$process) {
507 507
                 $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
508 508
                 $newTotal = $cond->applyCondition($toBeCalculated);
509 509
                 $process++;
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $process = 0;
527 527
         $conditions = $this
528 528
             ->getConditions()
529
-            ->filter(function ($cond) {
529
+            ->filter(function($cond) {
530 530
                 return $cond->getTarget() === 'subtotal';
531 531
             });
532 532
         // if no conditions were added, just return the sub total
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
             return $subTotal;
535 535
         }
536 536
         $conditions
537
-            ->each(function ($cond) use ($subTotal, &$newTotal, &$process) {
537
+            ->each(function($cond) use ($subTotal, &$newTotal, &$process) {
538 538
                 $toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
539 539
                 $newTotal = $cond->applyConditionWithoutTax($toBeCalculated);
540 540
                 $process++;
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     public function remove($id)
553 553
     {
554 554
         $cart = $this->getContent();
555
-        if($this->fireEvent('removing', $id) === false) {
555
+        if ($this->fireEvent('removing', $id) === false) {
556 556
             return false;
557 557
         }
558 558
         $cart->forget($id);
@@ -599,18 +599,18 @@  discard block
 block discarded – undo
599 599
     public function getVoucher()
600 600
     {
601 601
         $voucher = $this->session->get($this->sessionKeyCartVoucher);
602
-        if($voucher){
602
+        if ($voucher) {
603 603
 
604 604
         $totalWithTax = self::getTotalWithTax();
605 605
         $totalWithoutTax = self::getTotalWithoutTax();
606
-        $voucher['used_value_with_tax']  = $voucher['value'];
607
-        $voucher['used_value_without_tax']  = $voucher['value'];
608
-        if($totalWithTax <= $voucher['value']) {
609
-            $voucher['used_value_with_tax']  = $voucher['value'] - ($voucher['value'] - $totalWithTax);
606
+        $voucher['used_value_with_tax'] = $voucher['value'];
607
+        $voucher['used_value_without_tax'] = $voucher['value'];
608
+        if ($totalWithTax <= $voucher['value']) {
609
+            $voucher['used_value_with_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithTax);
610 610
         }
611 611
 
612
-        if($totalWithTax <= $voucher['value']) {
613
-            $voucher['used_value_without_tax']  = $voucher['value'] - ($voucher['value'] - $totalWithoutTax);
612
+        if ($totalWithTax <= $voucher['value']) {
613
+            $voucher['used_value_without_tax'] = $voucher['value'] - ($voucher['value'] - $totalWithoutTax);
614 614
         }
615 615
 
616 616
         $this->session->put($this->sessionKeyCartVoucher, $voucher);
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
      */
652 652
     public function clear()
653 653
     {
654
-        if($this->fireEvent('clearing') === false) {
654
+        if ($this->fireEvent('clearing') === false) {
655 655
             return false;
656 656
         }
657 657
         $this->session->put(
@@ -669,6 +669,6 @@  discard block
 block discarded – undo
669 669
      */
670 670
     protected function fireEvent($name, $value = [])
671 671
     {
672
-        return $this->events->fire($this->getInstanceName() . '.' . $name, array_values([$value, $this]));
672
+        return $this->events->fire($this->getInstanceName().'.'.$name, array_values([$value, $this]));
673 673
     }  
674 674
 }
675 675
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -272,7 +272,9 @@
 block discarded – undo
272 272
             }
273 273
             return $this;
274 274
         }
275
-        if (!$condition instanceof CartCondition) throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\'');
275
+        if (!$condition instanceof CartCondition) {
276
+            throw new InvalidConditionException('Argument 1 must be an instance of \'Darryldecode\Cart\CartCondition\'');
277
+        }
276 278
         $conditions = $this->getConditions();
277 279
         // Check if order has been applied
278 280
         if ($condition->getOrder() == 0) {
Please login to merge, or discard this patch.
src/Services/Cart/Helpers/Helpers.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function isMultiArray($array, $recursive = false)
27 27
     {
28
-        if( $recursive )
28
+        if ($recursive)
29 29
         {
30 30
             return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
31 31
         }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
57 57
     {
58
-        if( (isset($var)) && ($var!='') ) return $var;
58
+        if ((isset($var)) && ($var != '')) return $var;
59 59
 
60 60
         return $default;
61 61
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public static function formatValue($value, $format_numbers, $config)
64 64
     {
65 65
        
66
-        if($format_numbers && $config['format_numbers']) {
66
+        if ($format_numbers && $config['format_numbers']) {
67 67
 
68 68
 
69 69
             return number_format($value, $config['decimals'], $config['dec_point'], $config['thousands_sep']);
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,16 +28,14 @@  discard block
 block discarded – undo
28 28
         if( $recursive )
29 29
         {
30 30
             return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
31
-        }
32
-        else
31
+        } else
33 32
         {
34 33
             foreach ($array as $k => $v)
35 34
             {
36 35
                 if (is_array($v))
37 36
                 {
38 37
                     return true;
39
-                }
40
-                else
38
+                } else
41 39
                 {
42 40
                     return false;
43 41
                 }
@@ -55,7 +53,9 @@  discard block
 block discarded – undo
55 53
      */
56 54
     public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
57 55
     {
58
-        if( (isset($var)) && ($var!='') ) return $var;
56
+        if( (isset($var)) && ($var!='') ) {
57
+            return $var;
58
+        }
59 59
 
60 60
         return $default;
61 61
     }
Please login to merge, or discard this patch.
src/Services/Cart/CartCondition.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     {
27 27
         $this->args = $args;
28 28
 
29
-        if( Helpers::isMultiArray($args) )
29
+        if (Helpers::isMultiArray($args))
30 30
         {
31 31
             Throw new InvalidConditionException('Multi dimensional array is not supported.');
32 32
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function applyConditionWithoutTax($totalOrSubTotalOrPrice)
129 129
     {
130
-        if(isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) {
130
+        if (isset($this->getAttributes()['data']['value_ex_tax']) AND $this->args['value']) {
131 131
             return $this->apply($totalOrSubTotalOrPrice, $this->getAttributes()['data']['value_ex_tax']);            
132 132
         }
133 133
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
         // has a minus or plus sign so we can decide what to do with the
174 174
         // percentage, whether to add or subtract it to the total/subtotal/price
175 175
         // if we can't find any plus/minus sign, we will assume it as plus sign
176
-        if( $this->valueIsPercentage($conditionValue) )
176
+        if ($this->valueIsPercentage($conditionValue))
177 177
         {
178
-            if( $this->valueIsToBeSubtracted($conditionValue) )
178
+            if ($this->valueIsToBeSubtracted($conditionValue))
179 179
             {
180
-                $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
180
+                $value = Helpers::normalizePrice($this->cleanValue($conditionValue));
181 181
 
182 182
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
183 183
 
184 184
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
185 185
             }
186
-            else if ( $this->valueIsToBeAdded($conditionValue) )
186
+            else if ($this->valueIsToBeAdded($conditionValue))
187 187
             {
188
-                $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
188
+                $value = Helpers::normalizePrice($this->cleanValue($conditionValue));
189 189
 
190 190
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
191 191
 
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
         // next is we will check if it has a minus/plus sign so then we can just deduct it to total/subtotal/price
206 206
         else
207 207
         {
208
-            if( $this->valueIsToBeSubtracted($conditionValue) )
208
+            if ($this->valueIsToBeSubtracted($conditionValue))
209 209
             {
210
-                $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
210
+                $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue));
211 211
 
212 212
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
213 213
             }
214
-            else if ( $this->valueIsToBeAdded($conditionValue) )
214
+            else if ($this->valueIsToBeAdded($conditionValue))
215 215
             {
216
-                $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
216
+                $this->parsedRawValue = Helpers::normalizePrice($this->cleanValue($conditionValue));
217 217
 
218 218
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
219 219
             }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
      */
271 271
     protected function cleanValue($value)
272 272
     {
273
-        return str_replace(array('%','-','+'),'',$value);
273
+        return str_replace(array('%', '-', '+'), '', $value);
274 274
     }
275 275
 
276 276
     /**
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
         if( Helpers::isMultiArray($args) )
30 30
         {
31 31
             Throw new InvalidConditionException('Multi dimensional array is not supported.');
32
-        }
33
-        else
32
+        } else
34 33
         {
35 34
             $this->validate($this->args);
36 35
         }
@@ -182,16 +181,14 @@  discard block
 block discarded – undo
182 181
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
183 182
 
184 183
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
185
-            }
186
-            else if ( $this->valueIsToBeAdded($conditionValue) )
184
+            } else if ( $this->valueIsToBeAdded($conditionValue) )
187 185
             {
188 186
                 $value = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
189 187
 
190 188
                 $this->parsedRawValue = $totalOrSubTotalOrPrice * ($value / 100);
191 189
 
192 190
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
193
-            }
194
-            else
191
+            } else
195 192
             {
196 193
                 $value = Helpers::normalizePrice($conditionValue);
197 194
 
@@ -210,14 +207,12 @@  discard block
 block discarded – undo
210 207
                 $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
211 208
 
212 209
                 $result = floatval($totalOrSubTotalOrPrice - $this->parsedRawValue);
213
-            }
214
-            else if ( $this->valueIsToBeAdded($conditionValue) )
210
+            } else if ( $this->valueIsToBeAdded($conditionValue) )
215 211
             {
216 212
                 $this->parsedRawValue = Helpers::normalizePrice( $this->cleanValue($conditionValue) );
217 213
 
218 214
                 $result = floatval($totalOrSubTotalOrPrice + $this->parsedRawValue);
219
-            }
220
-            else
215
+            } else
221 216
             {
222 217
                 $this->parsedRawValue = Helpers::normalizePrice($conditionValue);
223 218
 
Please login to merge, or discard this patch.
src/Services/Cart/ItemCollection.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     protected $config;
15 15
 
16
-   /**
16
+    /**
17 17
      * ItemCollection constructor.
18 18
      * @param array|mixed $items
19 19
      */
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
         $newPrice = 0.00;
69 69
         $processed = 0;
70 70
 
71
-        if( $this->hasConditions() )
71
+        if ($this->hasConditions())
72 72
         {
73
-            if( is_array($this->conditions) )
73
+            if (is_array($this->conditions))
74 74
             {
75
-                foreach($this->conditions as $condition)
75
+                foreach ($this->conditions as $condition)
76 76
                 {
77
-                    if( $condition->getTarget() === 'item' )
77
+                    if ($condition->getTarget() === 'item')
78 78
                     {
79
-                        ( $processed > 0 ) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
79
+                        ($processed > 0) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
80 80
                         $newPrice = $condition->applyCondition($toBeCalculated);
81 81
                         $processed++;
82 82
                     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             }
85 85
             else
86 86
             {
87
-                if( $this['conditions']->getTarget() === 'item' )
87
+                if ($this['conditions']->getTarget() === 'item')
88 88
                 {
89 89
                     $newPrice = $this['conditions']->applyCondition($originalPrice);
90 90
                 }
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
         $newPrice = 0.00;
108 108
         $processed = 0;
109 109
 
110
-        if( $this->hasConditions() )
110
+        if ($this->hasConditions())
111 111
         {
112
-            if( is_array($this->conditions) )
112
+            if (is_array($this->conditions))
113 113
             {
114
-                foreach($this->conditions as $condition)
114
+                foreach ($this->conditions as $condition)
115 115
                 {
116
-                    if( $condition->getTarget() === 'item' )
116
+                    if ($condition->getTarget() === 'item')
117 117
                     {
118
-                        ( $processed > 0 ) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
118
+                        ($processed > 0) ? $toBeCalculated = $newPrice : $toBeCalculated = $originalPrice;
119 119
                         $newPrice = $condition->applyCondition($toBeCalculated);
120 120
                         $processed++;
121 121
                     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             }
124 124
             else
125 125
             {
126
-                if( $this['conditions']->getTarget() === 'item' )
126
+                if ($this['conditions']->getTarget() === 'item')
127 127
                 {
128 128
                     $newPrice = $this['conditions']->applyCondition($originalPrice);
129 129
                 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
     public function __get($name)
161 161
     {
162
-        if( $this->has($name) ) return $this->get($name);
162
+        if ($this->has($name)) return $this->get($name);
163 163
         return null;
164 164
     }
165 165
 
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function hasConditions()
172 172
     {
173
-        if( ! isset($this['conditions']) ) return false;
174
-        if( is_array($this['conditions']) )
173
+        if (!isset($this['conditions'])) return false;
174
+        if (is_array($this['conditions']))
175 175
         {
176 176
             return count($this['conditions']) > 0;
177 177
         }
178 178
         $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition";
179
-        if( $this['conditions'] instanceof $conditionInstance ) return true;
179
+        if ($this['conditions'] instanceof $conditionInstance) return true;
180 180
         return false;
181 181
     }
182 182
     
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function getConditions()
189 189
     {
190
-        if(! $this->hasConditions() ) return [];
190
+        if (!$this->hasConditions()) return [];
191 191
         return $this['conditions'];
192 192
     }
193 193
 }
194 194
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +14 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
                         $processed++;
82 82
                     }
83 83
                 }
84
-            }
85
-            else
84
+            } else
86 85
             {
87 86
                 if( $this['conditions']->getTarget() === 'item' )
88 87
                 {
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
                         $processed++;
121 120
                     }
122 121
                 }
123
-            }
124
-            else
122
+            } else
125 123
             {
126 124
                 if( $this['conditions']->getTarget() === 'item' )
127 125
                 {
@@ -159,7 +157,9 @@  discard block
 block discarded – undo
159 157
 
160 158
     public function __get($name)
161 159
     {
162
-        if( $this->has($name) ) return $this->get($name);
160
+        if( $this->has($name) ) {
161
+            return $this->get($name);
162
+        }
163 163
         return null;
164 164
     }
165 165
 
@@ -170,13 +170,17 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function hasConditions()
172 172
     {
173
-        if( ! isset($this['conditions']) ) return false;
173
+        if( ! isset($this['conditions']) ) {
174
+            return false;
175
+        }
174 176
         if( is_array($this['conditions']) )
175 177
         {
176 178
             return count($this['conditions']) > 0;
177 179
         }
178 180
         $conditionInstance = "Hideyo\\Services\\Cart\\CartCondition";
179
-        if( $this['conditions'] instanceof $conditionInstance ) return true;
181
+        if( $this['conditions'] instanceof $conditionInstance ) {
182
+            return true;
183
+        }
180 184
         return false;
181 185
     }
182 186
     
@@ -187,7 +191,9 @@  discard block
 block discarded – undo
187 191
      */
188 192
     public function getConditions()
189 193
     {
190
-        if(! $this->hasConditions() ) return [];
194
+        if(! $this->hasConditions() ) {
195
+            return [];
196
+        }
191 197
         return $this['conditions'];
192 198
     }
193 199
 }
194 200
\ No newline at end of file
Please login to merge, or discard this patch.
src/Services/Cart/Entity/CartRepository.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
                 }
76 76
 
77 77
                 Cart::update($productId, array(
78
-                  'quantity' => array(
79
-                      'relative' => false,
80
-                      'value' => $amount
81
-                  ),
78
+                    'quantity' => array(
79
+                        'relative' => false,
80
+                        'value' => $amount
81
+                    ),
82 82
                 ));
83 83
             } else {
84 84
                 Cart::remove($productId);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
                     if ($preSaleDiscount['discount_way'] == 'amount') {
146 146
                         $discountValue = "-".$preSaleDiscount->value;
147
-                      } elseif ($preSaleDiscount['discount_way'] == 'percent') {          
147
+                        } elseif ($preSaleDiscount['discount_way'] == 'percent') {          
148 148
                         $discountValue = "-".$preSaleDiscount['value']."%";                    
149 149
                     }                     
150 150
                 }
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                     $productArray['reference_code'] = $productCombination->reference_code;
49 49
                 }
50 50
 
51
-                $productArray['product_images'] =     ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
51
+                $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId), $productAttributeId);
52 52
             }
53 53
 
54 54
             if ($product->amountSeries()->where('active', '=', '1')->count()) {
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
                 $productArray['product_amount_series_range'] = $product->amountSeries()->where('active', '=', '1')->first()->range();
57 57
             }
58 58
 
59
-            if($productArray['price_details']['amount'] > 0) {
59
+            if ($productArray['price_details']['amount'] > 0) {
60 60
 
61
-                if($amount >= $productArray['price_details']['amount']) {
61
+                if ($amount >= $productArray['price_details']['amount']) {
62 62
                     $amount = $productArray['price_details']['amount'];
63 63
                 }
64 64
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 Cart::remove($productId);
73 73
             }
74 74
 
75
-            if(Cart::getConditionsByType('sending_method_country_price')->count()) {
75
+            if (Cart::getConditionsByType('sending_method_country_price')->count()) {
76 76
                 $this->updateSendingMethodCountryPrice(Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price_id']);  
77 77
             }
78 78
         }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     $productArray['reference_code'] = $productCombination->reference_code;
113 113
                 }
114 114
 
115
-                $productArray['product_images'] =     ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
115
+                $productArray['product_images'] = ProductService::ajaxProductImages($product, array($leadingAttributeId, $productAttributeId));
116 116
             }
117 117
 
118 118
             $productId = $productArray['id'];
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
             $discountValue = false;
125 125
 
126
-            if(session()->get('preSaleDiscount')) {
126
+            if (session()->get('preSaleDiscount')) {
127 127
                 $preSaleDiscount = session()->get('preSaleDiscount');             
128 128
 
129 129
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                     }                     
138 138
                 }
139 139
 
140
-                if($preSaleDiscount['products']) {
140
+                if ($preSaleDiscount['products']) {
141 141
 
142 142
                     $productIds = array_column($preSaleDiscount['products'], 'id');
143 143
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             }
164 164
 
165 165
             $discountCondition = array();
166
-            if($discountValue) {
166
+            if ($discountValue) {
167 167
 
168 168
                 $discountCondition = new \Hideyo\Ecommerce\Framework\Services\Cart\CartCondition(array(
169 169
                     'name' => 'Discount',
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
                 ));
174 174
             }
175 175
 
176
-            return Cart::add($productId, $productArray,  $amount, $discountCondition);
176
+            return Cart::add($productId, $productArray, $amount, $discountCondition);
177 177
         }
178 178
 
179 179
         return false;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         if (isset($sendingMethod->id)) {
187 187
             $sendingMethodArray = $sendingMethod->toArray();          
188 188
             $sendingMethodArray['price_details'] = $sendingMethod->getPriceDetails();
189
-            if($sendingMethod->relatedPaymentMethodsActive) {
189
+            if ($sendingMethod->relatedPaymentMethodsActive) {
190 190
                 $sendingMethodArray['related_payment_methods_list'] = $sendingMethod->relatedPaymentMethodsActive->pluck('title', 'id');                
191 191
             }
192 192
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $valueIncTax = $paymentMethodArray['price_details']['original_price_inc_tax'];
227 227
         $shop = ShopService::find(config()->get('app.shop_id'));
228 228
         $value = $valueIncTax;
229
-        $freeSending = ( $paymentMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
229
+        $freeSending = ($paymentMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
230 230
 
231 231
 
232 232
         if ($freeSending < 0) {
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             $valueExTax = $sendingMethodArray['price_details']['original_price_ex_tax'];
280 280
             $valueIncTax = $sendingMethodArray['price_details']['original_price_inc_tax'];
281 281
             $value = $valueIncTax;
282
-            $freeSending = ( $sendingMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
282
+            $freeSending = ($sendingMethodArray['no_price_from'] - Cart::getSubTotalWithTax());
283 283
       
284 284
             if ($freeSending < 0) {
285 285
                 $value = 0;
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
         $couponData = array();
353 353
         $discountValue = 0;
354 354
 
355
-        if($coupon) {
355
+        if ($coupon) {
356 356
 
357 357
             $couponData = $coupon->toArray();
358
-            if($coupon->type == 'total_price') {
358
+            if ($coupon->type == 'total_price') {
359 359
 
360
-                if($coupon->discount_way == 'total') {
360
+                if ($coupon->discount_way == 'total') {
361 361
                     $discountValue = $coupon->value;
362 362
                 } elseif ($coupon->discount_way == 'percent') {
363 363
                     $discountValue = $coupon->value.'%';
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
                 $this->setCouponCode($discountValue, $couponData, $couponCode);
367 367
             }
368 368
 
369
-            if($coupon->type == 'product') {
369
+            if ($coupon->type == 'product') {
370 370
 
371
-                if($coupon->products()->count()) {
371
+                if ($coupon->products()->count()) {
372 372
                     
373 373
                     foreach (Cart::getContent() as $row) {
374 374
 
@@ -376,9 +376,9 @@  discard block
 block discarded – undo
376 376
                         $explode = explode('-', $id);
377 377
                         $contains = $coupon->products->contains($explode[0]);
378 378
 
379
-                        if($contains) {
379
+                        if ($contains) {
380 380
 
381
-                            if($coupon->discount_way == 'total') {
381
+                            if ($coupon->discount_way == 'total') {
382 382
                                 $discountValue += $coupon->value;
383 383
                             } elseif ($coupon->discount_way == 'percent') {
384 384
                                 $value = $coupon->value / 100;                      
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
                 }
392 392
             }
393 393
 
394
-            if($coupon->type == 'product_category') {
394
+            if ($coupon->type == 'product_category') {
395 395
 
396
-                if($coupon->productCategories()->count()) {
396
+                if ($coupon->productCategories()->count()) {
397 397
 
398 398
                     foreach (Cart::getContent()->sortBy('id')  as $row) {
399 399
 
400 400
                         $contains = $coupon->productCategories->contains($row['attributes']['product_category_id']);
401 401
 
402
-                        if($contains) {
402
+                        if ($contains) {
403 403
 
404
-                            if($coupon->discount_way == 'total') {
404
+                            if ($coupon->discount_way == 'total') {
405 405
                                 $discountValue += $coupon->value;
406 406
                             } elseif ($coupon->discount_way == 'percent') {
407 407
                                 $value = $coupon->value / 100;                      
@@ -415,16 +415,16 @@  discard block
 block discarded – undo
415 415
                 }
416 416
             }
417 417
 
418
-            if($coupon->type == 'sending_method') {
418
+            if ($coupon->type == 'sending_method') {
419 419
 
420
-                if($coupon->sendingMethodCountries()->count()) {
420
+                if ($coupon->sendingMethodCountries()->count()) {
421 421
 
422 422
                     foreach ($coupon->sendingMethodCountries as $country) {
423 423
 
424
-                        if(Cart::getConditionsByType('sending_method_country_price')){
425
-                            if($country->name == Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
424
+                        if (Cart::getConditionsByType('sending_method_country_price')) {
425
+                            if ($country->name == Cart::getConditionsByType('sending_method_country_price')->first()->getAttributes()['data']['sending_method_country_price']['name']) {
426 426
 
427
-                                if($coupon->discount_way == 'total') {
427
+                                if ($coupon->discount_way == 'total') {
428 428
                                     $discountValue += $coupon->value;
429 429
                                 } elseif ($coupon->discount_way == 'percent') {
430 430
                                     $value = $coupon->value / 100; 
@@ -436,15 +436,15 @@  discard block
 block discarded – undo
436 436
 
437 437
                     $this->setCouponCode($discountValue, $couponData, $couponCode);
438 438
 
439
-                } elseif($coupon->sendingMethods()->count()) {
439
+                } elseif ($coupon->sendingMethods()->count()) {
440 440
 
441 441
                     foreach ($coupon->sendingMethods as $sendingMethod) {
442 442
 
443
-                        if(Cart::getConditionsByType('sending_cost')){
443
+                        if (Cart::getConditionsByType('sending_cost')) {
444 444
 
445
-                            if($sendingMethod->id == Cart::getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
445
+                            if ($sendingMethod->id == Cart::getConditionsByType('sending_cost')->first()->getAttributes()['data']['sending_method']['id']) {
446 446
 
447
-                                if($coupon->discount_way == 'total') {
447
+                                if ($coupon->discount_way == 'total') {
448 448
                                     $discountValue += $coupon->value;
449 449
                                 } elseif ($coupon->discount_way == 'percent') {
450 450
                                     $value = $coupon->value / 100; 
@@ -458,17 +458,17 @@  discard block
 block discarded – undo
458 458
                 }
459 459
             }
460 460
 
461
-            if($coupon->type == 'payment_method') {
461
+            if ($coupon->type == 'payment_method') {
462 462
 
463
-                if($coupon->paymentMethods()->count()) {
463
+                if ($coupon->paymentMethods()->count()) {
464 464
 
465 465
                     foreach ($coupon->paymentMethods as $paymentMethod) {
466 466
 
467
-                        if(Cart::getConditionsByType('payment_method')){
467
+                        if (Cart::getConditionsByType('payment_method')) {
468 468
 
469
-                            if($paymentMethod->id == Cart::getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
469
+                            if ($paymentMethod->id == Cart::getConditionsByType('payment_method')->first()->getAttributes()['data']['id']) {
470 470
 
471
-                                if($coupon->discount_way == 'total') {
471
+                                if ($coupon->discount_way == 'total') {
472 472
                                     $discountValue += $coupon->value;
473 473
                                 } elseif ($coupon->discount_way == 'percent') {
474 474
                                     $value = $coupon->value / 100; 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         );
521 521
 
522 522
         foreach ($replace as $key => $val) {
523
-            $content = str_replace("[" . $key . "]", $val, $content);
523
+            $content = str_replace("[".$key."]", $val, $content);
524 524
         }
525 525
         $content = nl2br($content);
526 526
         return $content;
Please login to merge, or discard this patch.
src/Services/News/NewsService.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,24 +9,24 @@  discard block
 block discarded – undo
9 9
  
10 10
 class NewsService extends BaseService
11 11
 {
12
-	public function __construct(NewsRepository $news)
13
-	{
14
-		$this->repo = $news;
15
-	} 
12
+    public function __construct(NewsRepository $news)
13
+    {
14
+        $this->repo = $news;
15
+    } 
16 16
 
17 17
     public function selectByLimitAndOrderBy($shopId, $limit, $orderBy)
18 18
     {
19
-    	return $this->repo->selectByLimitAndOrderBy($shopId, $limit, $orderBy);
19
+        return $this->repo->selectByLimitAndOrderBy($shopId, $limit, $orderBy);
20 20
     }
21 21
 
22 22
     public function selectOneBySlug($shopId, $slug)
23 23
     {
24
-    	return $this->repo->selectOneBySlug($shopId, $slug);
24
+        return $this->repo->selectOneBySlug($shopId, $slug);
25 25
     }
26 26
 
27 27
     public function selectAllActiveGroupsByShopId($shopId)
28 28
     {
29
-    	return $this->repo->selectAllActiveGroupsByShopId($shopId);
29
+        return $this->repo->selectAllActiveGroupsByShopId($shopId);
30 30
     }
31 31
 
32 32
     public function findGroup($groupId)
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     public function selectAllGroups()
53 53
     {
54
-       return $this->repo->selectAllGroups();
54
+        return $this->repo->selectAllGroups();
55 55
     }
56 56
 
57 57
 
Please login to merge, or discard this patch.
src/Services/News/Entity/NewsImage.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 = 'news_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 = ['news_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id',];
17
+    protected $fillable = ['news_id', 'file', 'extension', 'size', 'path', 'rank', 'tag', 'modified_by_user_id', ];
18 18
 
19 19
     public function news()
20 20
     {
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.