@@ -33,6 +33,6 @@ |
||
33 | 33 | |
34 | 34 | function selectAllByInvoiceId($orderId) |
35 | 35 | { |
36 | - return $this->model->where('order_id', '=', $orderId)->get(); |
|
36 | + return $this->model->where('order_id', '=', $orderId)->get(); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -15,11 +15,11 @@ |
||
15 | 15 | protected $table = 'invoice'; |
16 | 16 | |
17 | 17 | // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model. |
18 | - protected $fillable = ['order_id', 'type', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'bill_invoice_address_id', 'delivery_invoice_address_id',]; |
|
18 | + protected $fillable = ['order_id', 'type', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'bill_invoice_address_id', 'delivery_invoice_address_id', ]; |
|
19 | 19 | |
20 | 20 | public static function boot() |
21 | 21 | { |
22 | - static::creating(function ($model) { |
|
22 | + static::creating(function($model) { |
|
23 | 23 | |
24 | 24 | $order = Invoice::whereNotNull('client_id')->where('shop_id', '=', $model->shop_id)->where('created_at', '>=', Carbon::now()->year)->orderBy('created_at', 'desc')->first(); |
25 | 25 | $shop = Shop::find($model->shop_id); |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function handle(OrderChangeStatus $event) |
35 | 35 | { |
36 | - if($event->order->shop->wholesale) { |
|
36 | + if ($event->order->shop->wholesale) { |
|
37 | 37 | |
38 | 38 | if ($event->status->send_email_to_customer) { |
39 | 39 | |
40 | 40 | if ($event->status->orderStatusEmailTemplate) { |
41 | 41 | |
42 | - $destinationPath = storage_path() . "/app"; |
|
42 | + $destinationPath = storage_path()."/app"; |
|
43 | 43 | $orderStatusEmailFromResult = GeneralSettingService::selectOneByShopIdAndName($event->order->shop_id, 'order-status-email-from'); |
44 | 44 | |
45 | 45 | $orderStatusEmailFrom = '[email protected]'; |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | |
58 | 58 | $orderStatusEmailBcc = '[email protected]'; |
59 | 59 | $language = 'en'; |
60 | - if(strtoupper($event->order->orderBillAddress->country) == 'NL') { |
|
60 | + if (strtoupper($event->order->orderBillAddress->country) == 'NL') { |
|
61 | 61 | $language = 'nl'; |
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | - Mail::send('frontend.email.order-status', ['content' => $this->cart->replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function ($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { |
|
65 | + Mail::send('frontend.email.order-status', ['content' => $this->cart->replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { |
|
66 | 66 | $message->from($orderStatusEmailFrom, $orderStatusEmailName); |
67 | 67 | $message->to($event->order->client->email, $event->order->orderBillAddress->firstname)->subject($this->cart->replaceTags($event->status->orderStatusEmailTemplate->translate($language)->subject, $event->order)); |
68 | 68 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($event->order and $event->status->attach_order_to_email) { |
74 | 74 | $pdfText = ""; |
75 | 75 | $sign = '€'; |
76 | - if($event->order->client->usd) { |
|
76 | + if ($event->order->client->usd) { |
|
77 | 77 | $sign = '$'; |
78 | 78 | } |
79 | 79 | |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if($event->order->type == 'pre_order') { |
|
99 | + if ($event->order->type == 'pre_order') { |
|
100 | 100 | |
101 | - }elseif($event->order->type == 'from_stock') { |
|
101 | + }elseif ($event->order->type == 'from_stock') { |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } else { |
108 | 108 | if ($event->status->send_email_to_customer) { |
109 | 109 | if ($event->status->orderStatusEmailTemplate) { |
110 | - $destinationPath = storage_path() . "/app"; |
|
110 | + $destinationPath = storage_path()."/app"; |
|
111 | 111 | $orderStatusEmailFromResult = GeneralSettingService::selectOneByShopIdAndName($event->order->shop_id, 'order-status-email-from'); |
112 | 112 | |
113 | 113 | $orderStatusEmailFrom = '[email protected]'; |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | $language = 'en'; |
133 | - if(strtoupper($event->order->orderBillAddress->country) == 'NL') { |
|
133 | + if (strtoupper($event->order->orderBillAddress->country) == 'NL') { |
|
134 | 134 | $language = 'nl'; |
135 | 135 | } |
136 | 136 | |
137 | - Mail::send('frontend.email.order-status', ['content' => $this->cart->replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function ($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { |
|
137 | + Mail::send('frontend.email.order-status', ['content' => $this->cart->replaceTags($event->status->orderStatusEmailTemplate->translate($language)->content, $event->order)], function($message) use ($event, $destinationPath, $orderStatusEmailFrom, $orderStatusEmailName, $orderStatusEmailBcc, $language) { |
|
138 | 138 | $message->from($orderStatusEmailFrom, $orderStatusEmailName); |
139 | 139 | $message->to($event->order->client->email, $event->order->orderBillAddress->firstname)->subject($this->cart->replaceTags($event->status->orderStatusEmailTemplate->translate($language)->subject, $event->order)); |
140 | 140 |
@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | if($event->order->type == 'pre_order') { |
100 | 100 | |
101 | - }elseif($event->order->type == 'from_stock') { |
|
101 | + } elseif($event->order->type == 'from_stock') { |
|
102 | 102 | |
103 | 103 | } |
104 | 104 |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | class OrderStatusEmailTemplateService extends BaseService |
12 | 12 | { |
13 | - public function __construct(OrderStatusEmailTemplateRepository $orderStatusEmailTemplate) |
|
14 | - { |
|
15 | - $this->repo = $orderStatusEmailTemplate; |
|
16 | - } |
|
13 | + public function __construct(OrderStatusEmailTemplateRepository $orderStatusEmailTemplate) |
|
14 | + { |
|
15 | + $this->repo = $orderStatusEmailTemplate; |
|
16 | + } |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | ); |
34 | 34 | |
35 | 35 | if ($id) { |
36 | - $rules['title'] = 'required|unique_with:order_status_email_template, shop_id,'.$id; |
|
36 | + $rules['title'] = 'required|unique_with:order_status_email_template, shop_id,'.$id; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return $rules; |
@@ -10,10 +10,10 @@ |
||
10 | 10 | |
11 | 11 | class OrderStatusService extends BaseService |
12 | 12 | { |
13 | - public function __construct(OrderStatusRepository $orderStatus) |
|
14 | - { |
|
15 | - $this->repo = $orderStatus; |
|
16 | - } |
|
13 | + public function __construct(OrderStatusRepository $orderStatus) |
|
14 | + { |
|
15 | + $this->repo = $orderStatus; |
|
16 | + } |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * The validation rules for the model. |
@@ -29,7 +29,7 @@ |
||
29 | 29 | ); |
30 | 30 | |
31 | 31 | if ($id) { |
32 | - $rules['title'] = 'required|between:4,65|unique_with:order_status, shop_id, '.$id.' = id'; |
|
32 | + $rules['title'] = 'required|between:4,65|unique_with:order_status, shop_id, '.$id.' = id'; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | return $rules; |
@@ -53,7 +53,7 @@ |
||
53 | 53 | } |
54 | 54 | }); |
55 | 55 | |
56 | - parent::boot(); |
|
56 | + parent::boot(); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function products() |
@@ -18,11 +18,11 @@ |
||
18 | 18 | protected $table = 'order'; |
19 | 19 | |
20 | 20 | // Add the 'avatar' attachment to the fillable array so that it's mass-assignable on this model. |
21 | - protected $fillable = ['id', 'validated', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'total_discount', 'coupon_id', 'coupon_title', 'coupon_discount_way', 'coupon_type', 'coupon_value', 'coupon_code', 'coupon_group_title', 'bill_order_address_id', 'delivery_order_address_id', 'order_status_id', 'mollie_payment_id', 'comments', 'present_gender', 'present_occassion', 'present_message', 'browser_detect']; |
|
21 | + protected $fillable = ['id', 'validated', 'client_id', 'shop_id', 'price_with_tax', 'price_without_tax', 'total_discount', 'coupon_id', 'coupon_title', 'coupon_discount_way', 'coupon_type', 'coupon_value', 'coupon_code', 'coupon_group_title', 'bill_order_address_id', 'delivery_order_address_id', 'order_status_id', 'mollie_payment_id', 'comments', 'present_gender', 'present_occassion', 'present_message', 'browser_detect']; |
|
22 | 22 | |
23 | 23 | public static function boot() |
24 | 24 | { |
25 | - static::creating(function ($model) { |
|
25 | + static::creating(function($model) { |
|
26 | 26 | |
27 | 27 | if ($model->created_at) { |
28 | 28 | $order = Order::where('shop_id', '=', $model->shop_id)->where('created_at', '>=', Carbon::createFromFormat('Y-m-d H:i:s', $model->created_at)->year)->orderBy('id', 'desc')->first(); |
@@ -18,10 +18,10 @@ |
||
18 | 18 | public function selectBySendingMethodIdAndPaymentMethodId($paymentMethodId, $sendingMethodId) |
19 | 19 | { |
20 | 20 | |
21 | - $result = $this->model->with(array('sendingPaymentMethodRelated' => function ($query) use ($paymentMethodId, $sendingMethodId) { |
|
22 | - $query->with(array('sendingMethod' => function ($query) use ($sendingMethodId) { |
|
21 | + $result = $this->model->with(array('sendingPaymentMethodRelated' => function($query) use ($paymentMethodId, $sendingMethodId) { |
|
22 | + $query->with(array('sendingMethod' => function($query) use ($sendingMethodId) { |
|
23 | 23 | $query->where('id', '=', $sendingMethodId); |
24 | - }, 'paymentMethod' => function ($query) use ($paymentMethodId) { |
|
24 | + }, 'paymentMethod' => function($query) use ($paymentMethodId) { |
|
25 | 25 | $query->where('id', '=', $paymentMethodId); |
26 | 26 | })); |
27 | 27 | } )) |
@@ -8,7 +8,7 @@ |
||
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 |
@@ -8,7 +8,9 @@ |
||
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 |
@@ -594,7 +594,6 @@ |
||
594 | 594 | /** |
595 | 595 | * get the cart voucher |
596 | 596 | * |
597 | - |
|
598 | 597 | */ |
599 | 598 | public function getVoucher() |
600 | 599 | { |
@@ -64,9 +64,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -272,7 +272,9 @@ |
||
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) { |