@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | protected $config; |
15 | 15 | |
16 | - /** |
|
16 | + /** |
|
17 | 17 | * ItemCollection constructor. |
18 | 18 | * @param array|mixed $items |
19 | 19 | */ |
@@ -68,15 +68,15 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -81,8 +81,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -75,10 +75,10 @@ discard block |
||
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 |
||
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 | } |
@@ -48,7 +48,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -9,24 +9,24 @@ discard block |
||
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 |
||
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 |
@@ -14,7 +14,7 @@ |
||
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 | { |
@@ -294,7 +294,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(), |
@@ -28,8 +28,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -9,10 +9,10 @@ |
||
9 | 9 | |
10 | 10 | class ExtraFieldService extends BaseService |
11 | 11 | { |
12 | - public function __construct(ExtraFieldRepository $extraField) |
|
13 | - { |
|
14 | - $this->repo = $extraField; |
|
15 | - } |
|
12 | + public function __construct(ExtraFieldRepository $extraField) |
|
13 | + { |
|
14 | + $this->repo = $extraField; |
|
15 | + } |
|
16 | 16 | |
17 | 17 | |
18 | 18 |
@@ -45,7 +45,7 @@ |
||
45 | 45 | ); |
46 | 46 | |
47 | 47 | if ($extraFieldId) { |
48 | - $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$extraFieldId.' = id'; |
|
48 | + $rules['title'] = 'required|between:4,65|unique_with:'.$this->repo->getModel()->getTable().', shop_id, '.$extraFieldId.' = id'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $rules; |
@@ -34,10 +34,10 @@ |
||
34 | 34 | return $this->model->select('extra_field.*') |
35 | 35 | ->leftJoin('product_category_related_extra_field', 'extra_field.id', '=', 'product_category_related_extra_field.extra_field_id') |
36 | 36 | |
37 | - ->where(function ($query) use ($productCategoryId) { |
|
37 | + ->where(function($query) use ($productCategoryId) { |
|
38 | 38 | |
39 | 39 | $query->where('all_products', '=', 1) |
40 | - ->orWhereHas('categories', function ($query) use ($productCategoryId) { |
|
40 | + ->orWhereHas('categories', function($query) use ($productCategoryId) { |
|
41 | 41 | |
42 | 42 | $query->where('product_category_id', '=', $productCategoryId); |
43 | 43 | }); |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | |
9 | 9 | class SendingMethodService extends BaseService |
10 | 10 | { |
11 | - public function __construct(SendingMethodRepository $sendingMethod) |
|
12 | - { |
|
13 | - $this->repo = $sendingMethod; |
|
14 | - } |
|
11 | + public function __construct(SendingMethodRepository $sendingMethod) |
|
12 | + { |
|
13 | + $this->repo = $sendingMethod; |
|
14 | + } |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * The validation rules for the model. |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | return $model; |
126 | 126 | } |
127 | 127 | |
128 | - public function selectAllActiveByShopId($shopId) |
|
128 | + public function selectAllActiveByShopId($shopId) |
|
129 | 129 | { |
130 | - return $this->repo->selectAllActiveByShopId($shopId); |
|
130 | + return $this->repo->selectAllActiveByShopId($shopId); |
|
131 | 131 | } |
132 | 132 | |
133 | - public function selectOneByShopIdAndId($shopId, $sendingMethodId) |
|
133 | + public function selectOneByShopIdAndId($shopId, $sendingMethodId) |
|
134 | 134 | { |
135 | - $result = $this->repo->selectOneByShopIdAndId($shopId, $sendingMethodId); |
|
135 | + $result = $this->repo->selectOneByShopIdAndId($shopId, $sendingMethodId); |
|
136 | 136 | |
137 | 137 | if ($result->isEmpty()) { |
138 | 138 | return false; |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | 'maximal_weight' => 'numeric|nullable' |
30 | 30 | ); |
31 | 31 | |
32 | - if($sendingMethodId) { |
|
33 | - $rules['title'] = $rules['title'].','.$sendingMethodId.' = id'; |
|
32 | + if ($sendingMethodId) { |
|
33 | + $rules['title'] = $rules['title'].','.$sendingMethodId.' = id'; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | return $rules; |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | 'name' => 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id' |
45 | 45 | ); |
46 | 46 | |
47 | - if($id) { |
|
48 | - $rules['name'] = 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id, '.$id.' = id'; |
|
47 | + if ($id) { |
|
48 | + $rules['name'] = 'required|between:4,65|unique_with:sending_method_country_price, sending_method_id, '.$id.' = id'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $rules; |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function selectOneByShopIdAndId($shopId, $sendingMethodId) |
22 | 22 | { |
23 | 23 | return $this->model->with( |
24 | - array('relatedPaymentMethods' => function ($query) { |
|
24 | + array('relatedPaymentMethods' => function($query) { |
|
25 | 25 | $query->where('active', '=', 1); |
26 | 26 | }) |
27 | 27 | )->where('shop_id', '=', $shopId)->where('active', '=', 1) |