From e1a0c0b8c624d563e1ccaad281f9a3b03940a366 Mon Sep 17 00:00:00 2001 From: jitendra Date: Tue, 12 Jul 2022 17:34:13 +0530 Subject: [PATCH] Convert if else statement to PSR-2 standard --- .../src/Http/Requests/ConfigurationForm.php | 12 ++- .../src/Providers/AdminServiceProvider.php | 10 +- .../views/catalog/attributes/create.blade.php | 2 +- .../views/catalog/attributes/edit.blade.php | 2 +- .../products/accordians/images.blade.php | 2 +- .../products/accordians/inventories.blade.php | 1 + .../products/accordians/variations.blade.php | 2 +- .../products/accordians/videos.blade.php | 2 +- .../views/catalog/products/edit.blade.php | 15 ++- .../dependent-field-type.blade.php | 2 +- .../customers/addresses/create.blade.php | 5 +- .../views/customers/addresses/edit.blade.php | 5 +- .../views/customers/country-state.blade.php | 3 +- .../Resources/views/layouts/master.blade.php | 6 +- .../views/layouts/mobile-nav.blade.php | 11 +-- .../views/sales/invoices/create.blade.php | 5 +- .../views/sales/invoices/view.blade.php | 5 +- .../views/sales/orders/view.blade.php | 20 +++- .../views/sales/refunds/create.blade.php | 5 +- .../views/sales/refunds/view.blade.php | 5 +- .../views/sales/shipments/create.blade.php | 10 +- .../views/sales/shipments/view.blade.php | 10 +- .../views/settings/locales/edit.blade.php | 5 +- .../Validations/ProductCategoryUniqueSlug.php | 12 ++- .../Attribute/src/Models/AttributeOption.php | 5 +- .../AttributeFamilyRepository.php | 5 +- .../AttributeOptionRepository.php | 5 +- .../src/Repositories/AttributeRepository.php | 10 +- .../BookingProduct/src/Helpers/Booking.php | 43 ++++++-- .../src/Helpers/DefaultSlot.php | 39 ++++++-- .../BookingProduct/src/Helpers/RentalSlot.php | 43 ++++++-- .../BookingProduct/src/Helpers/TableSlot.php | 5 +- .../Repositories/BookingProductRepository.php | 16 ++- .../src/Repositories/BookingRepository.php | 10 +- .../accordians/booking/default.blade.php | 3 +- .../accordians/booking/event.blade.php | 3 +- .../accordians/booking/slots.blade.php | 6 +- .../products/view/booking/table.blade.php | 5 +- .../view/booking/appointment.blade.php | 5 +- .../products/view/booking/table.blade.php | 5 +- .../BookingProduct/src/Type/Booking.php | 18 +++- .../Webkul/CartRule/src/Helpers/CartRule.php | 55 ++++++++--- .../Webkul/CartRule/src/Models/CartRule.php | 2 +- .../src/Repositories/CartRuleRepository.php | 5 +- .../src/Helpers/CatalogRuleProduct.php | 3 +- .../src/Helpers/CatalogRuleProductPrice.php | 16 ++- .../Http/Controllers/CategoryController.php | 5 +- .../src/Repositories/CategoryRepository.php | 10 +- packages/Webkul/Checkout/src/Cart.php | 63 +++++++++--- .../src/Http/Requests/CustomerAddressForm.php | 5 +- packages/Webkul/Core/src/Core.php | 57 ++++++++--- .../src/Helpers/Exchange/ExchangeRates.php | 5 +- .../src/Helpers/Exchange/FixerExchange.php | 5 +- .../src/Repositories/CoreConfigRepository.php | 25 ++++- .../Core/src/Traits/CoreConfigField.php | 10 +- packages/Webkul/Core/src/Tree.php | 5 +- .../Core/src/View/Compilers/BladeCompiler.php | 8 +- .../Http/Controllers/CustomerController.php | 10 +- .../Http/Controllers/WishlistController.php | 15 ++- .../CustomerAddressRepository.php | 10 +- .../src/DataCollector/ModuleCollector.php | 16 ++- .../Repositories/NotificationRepository.php | 10 +- .../Payment/src/Listeners/GenerateInvoice.php | 20 +++- .../Payment/src/Payment/MoneyTransfer.php | 3 +- .../Webkul/Payment/src/Payment/Payment.php | 3 +- packages/Webkul/Paypal/src/Helpers/Ipn.php | 5 +- .../Controllers/SmartButtonController.php | 15 ++- .../Paypal/src/Listeners/Transaction.php | 5 +- .../Product/src/Helpers/BundleOption.php | 5 +- .../src/Helpers/ConfigurableOption.php | 5 +- .../Product/src/Helpers/GenerateProduct.php | 16 ++- .../Webkul/Product/src/Helpers/Toolbar.php | 15 ++- packages/Webkul/Product/src/Helpers/View.php | 5 +- .../Http/Controllers/ProductController.php | 5 +- .../Product/src/Http/Requests/ProductForm.php | 10 +- .../Product/src/Listeners/ProductFlat.php | 15 ++- .../Webkul/Product/src/Models/ProductFlat.php | 8 +- packages/Webkul/Product/src/ProductImage.php | 6 +- .../ProductBundleOptionProductRepository.php | 10 +- .../Repositories/ProductFlatRepository.php | 18 +++- .../Repositories/ProductMediaRepository.php | 10 +- .../src/Repositories/ProductRepository.php | 6 +- .../Webkul/Product/src/Type/AbstractType.php | 98 +++++++++++++++---- packages/Webkul/Product/src/Type/Bundle.php | 20 +++- .../Webkul/Product/src/Type/Configurable.php | 20 +++- .../Webkul/Product/src/Type/Downloadable.php | 10 +- packages/Webkul/Product/src/Type/Grouped.php | 5 +- packages/Webkul/Product/src/Type/Simple.php | 6 +- packages/Webkul/Product/src/Type/Virtual.php | 6 +- .../Webkul/Rule/src/Helpers/Validator.php | 17 +++- .../Database/Factories/OrderItemFactory.php | 8 +- .../Webkul/Sales/src/Generators/Sequencer.php | 7 +- packages/Webkul/Sales/src/Models/Order.php | 32 ++++-- .../Webkul/Sales/src/Models/OrderItem.php | 4 +- .../DownloadableLinkPurchasedRepository.php | 5 +- .../Repositories/InvoiceItemRepository.php | 12 +-- .../src/Repositories/OrderItemRepository.php | 5 +- .../src/Repositories/OrderRepository.php | 25 ++++- .../src/Repositories/RefundItemRepository.php | 10 +- .../src/Repositories/RefundRepository.php | 10 +- packages/Webkul/Shipping/src/Shipping.php | 5 +- .../DataGrids/DownloadableProductDataGrid.php | 8 +- .../src/Http/Controllers/CartController.php | 12 ++- .../DownloadableProductController.php | 11 ++- .../Http/Controllers/OnepageController.php | 57 ++++++++--- .../src/Http/Controllers/ReviewController.php | 5 +- .../Controllers/SubscriptionController.php | 6 +- .../Webkul/Shop/src/Http/Middleware/Theme.php | 5 +- .../views/checkout/cart/index.blade.php | 13 ++- .../views/checkout/onepage.blade.php | 6 +- .../onepage/customer-checkout.blade.php | 5 +- .../checkout/onepage/customer-info.blade.php | 10 +- .../views/checkout/onepage/review.blade.php | 5 +- .../account/address/create.blade.php | 5 +- .../customers/account/address/edit.blade.php | 5 +- .../guest/compare/compare-products.blade.php | 4 +- .../views/layouts/header/index.blade.php | 2 +- .../Resources/views/products/index.blade.php | 2 +- .../views/products/list/card.blade.php | 5 +- .../views/products/reviews/create.blade.php | 5 +- .../views/products/reviews/index.blade.php | 5 +- .../Resources/views/products/view.blade.php | 5 +- .../views/products/view/attributes.blade.php | 11 ++- .../products/view/downloadable.blade.php | 5 +- .../views/products/view/reviews.blade.php | 10 +- packages/Webkul/Tax/src/Helpers/Tax.php | 20 +++- .../Http/Controllers/TaxRateController.php | 10 +- packages/Webkul/Theme/src/ThemeViewFinder.php | 10 +- packages/Webkul/Theme/src/Themes.php | 20 +++- .../Ui/src/DataGrid/Traits/ProvideBouncer.php | 5 +- .../src/DataGrid/Traits/ProvideCollection.php | 27 ++++- .../DataGrid/Traits/ProvideQueryResolver.php | 10 +- .../Resources/views/datagrid/body.blade.php | 17 +++- .../partials/default-header.blade.php | 6 +- .../Resources/views/datagrid/table.blade.php | 17 ++-- packages/Webkul/User/src/Bouncer.php | 15 ++- .../Http/Controllers/AccountController.php | 5 +- .../src/Http/Controllers/RoleController.php | 5 +- .../src/Http/Controllers/UserController.php | 15 ++- .../User/src/Http/Middleware/Bouncer.php | 10 +- packages/Webkul/User/src/Models/Admin.php | 5 +- .../User/src/Repositories/AdminRepository.php | 5 +- .../Webkul/Velocity/src/Helpers/Helper.php | 10 +- .../Admin/ConfigurationController.php | 21 +++- .../Controllers/Admin/ContentController.php | 10 +- .../Http/Controllers/Shop/CartController.php | 5 +- .../src/Repositories/CategoryRepository.php | 5 +- .../src/Repositories/ContentRepository.php | 5 +- .../Product/ProductRepository.php | 5 +- .../categories/category-icon.blade.php | 5 +- .../views/shop/checkout/cart/index.blade.php | 5 +- .../views/shop/checkout/onepage.blade.php | 2 +- .../onepage/customer-checkout.blade.php | 5 +- .../onepage/customer-new-form.blade.php | 10 +- .../shop/checkout/onepage/review.blade.php | 5 +- .../account/address/create.blade.php | 5 +- .../customers/account/address/edit.blade.php | 5 +- .../guest/compare/compare-products.blade.php | 4 +- .../advertisement-four.blade.php | 10 +- .../advertisement-one.blade.php | 5 +- .../advertisement-three.blade.php | 5 +- .../advertisement-two.blade.php | 10 +- .../shop/home/customer-reviews.blade.php | 2 +- .../views/shop/home/slider.blade.php | 5 +- .../footer/newsletter-subscription.blade.php | 5 +- .../views/shop/layouts/styles.blade.php | 5 +- .../layouts/top-nav/locale-currency.blade.php | 15 ++- .../views/shop/products/add-to-cart.blade.php | 30 ++++-- .../views/shop/products/list/card.blade.php | 15 ++- .../shop/products/reviews/create.blade.php | 5 +- .../views/shop/products/view.blade.php | 5 +- .../shop/products/view/attributes.blade.php | 10 +- .../shop/products/view/downloadable.blade.php | 5 +- .../shop/products/view/reviews.blade.php | 15 ++- .../views/shop/search/search.blade.php | 5 +- 175 files changed, 1468 insertions(+), 413 deletions(-) diff --git a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php index 50960cbce..7fc213d27 100644 --- a/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php +++ b/packages/Webkul/Admin/src/Http/Requests/ConfigurationForm.php @@ -26,7 +26,8 @@ class ConfigurationForm extends FormRequest { $this->rules = []; - if (request()->has('catalog.products.storefront.products_per_page') + if ( + request()->has('catalog.products.storefront.products_per_page') && ! empty(request()->input('catalog.products.storefront.products_per_page')) ) { $this->rules = [ @@ -34,7 +35,8 @@ class ConfigurationForm extends FormRequest ]; } - if (request()->has('general.design.admin_logo.logo_image') + if ( + request()->has('general.design.admin_logo.logo_image') && ! request()->input('general.design.admin_logo.logo_image.delete') ) { $this->rules = array_merge($this->rules, [ @@ -42,7 +44,8 @@ class ConfigurationForm extends FormRequest ]); } - if (request()->has('general.design.admin_logo.favicon') + if ( + request()->has('general.design.admin_logo.favicon') && ! request()->input('general.design.admin_logo.favicon.delete') ) { $this->rules = array_merge($this->rules, [ @@ -50,7 +53,8 @@ class ConfigurationForm extends FormRequest ]); } - if (request()->has('sales.invoice_setttings.invoice_slip_design.logo') + if ( + request()->has('sales.invoice_setttings.invoice_slip_design.logo') && ! request()->input('sales.invoice_setttings.invoice_slip_design.logo.delete') ) { $this->rules = array_merge($this->rules, [ diff --git a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php index 1e5e8b6d8..cf9b31262 100755 --- a/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php +++ b/packages/Webkul/Admin/src/Providers/AdminServiceProvider.php @@ -94,10 +94,16 @@ class AdminServiceProvider extends ServiceProvider continue; } - if ($index + 1 < count(config('menu.admin')) && $permissionType != 'all') { + if ( + $index + 1 < count(config('menu.admin')) + && $permissionType != 'all' + ) { $permission = config('menu.admin')[$index + 1]; - if (substr_count($permission['key'], '.') == 2 && substr_count($item['key'], '.') == 1) { + if ( + substr_count($permission['key'], '.') == 2 + && substr_count($item['key'], '.') == 1 + ) { foreach ($allowedPermissions as $key => $value) { if ($item['key'] == $value) { $neededItem = $allowedPermissions[$key + 1]; diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php index f4e492303..73360f8f5 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/create.blade.php @@ -469,7 +469,7 @@ if (! this.idNullOption) { this.addOptionRow(true); } - } elseif(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') { + } else if(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') { const row = this.optionRows.find(optionRow => optionRow.id === this.idNullOption); this.removeRow(row); } diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php index 0346f8419..268f73801 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/attributes/edit.blade.php @@ -455,7 +455,7 @@ if (! this.idNullOption) { this.addOptionRow(true); } - } elseif(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') { + } else if(this.idNullOption !== null && typeof this.idNullOption !== 'undefined') { const row = this.optionRows.find(optionRow => optionRow.id === this.idNullOption); this.removeRow(row); } diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/images.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/images.blade.php index 844cef0e1..8de136713 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/images.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/images.blade.php @@ -166,7 +166,7 @@ mounted () { if (this.image.id && this.image.url) { this.imageData = this.image.url; - } elseif (this.image.id && this.image.file) { + } else if (this.image.id && this.image.file) { this.readFile(this.image.file); } }, diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/inventories.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/inventories.blade.php index ad6445c10..d5c56abd4 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/inventories.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/inventories.blade.php @@ -12,6 +12,7 @@ foreach ($product->inventories as $inventory) { if ($inventory->inventory_source_id == $inventorySource->id) { $qty = $inventory->qty; + break; } } diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php index fe89f9707..a24c6fcbe 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/variations.blade.php @@ -521,7 +521,7 @@ if (image.id && image.url) { self.imageData.push(image.url); - } elseif (image.id && image.file) { + } else if (image.id && image.file) { self.readFile(image.file); } }); diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/videos.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/videos.blade.php index 1cd9840d5..506f1c643 100644 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/videos.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/accordians/videos.blade.php @@ -164,7 +164,7 @@ mounted () { if (this.video.id && this.video.url) { this.videoData = this.video.url; - } elseif (this.video.id && this.video.file) { + } else if (this.video.id && this.video.file) { this.readFile(this.video.file); } }, diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php index 409b0b67a..bdbac5461 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/edit.blade.php @@ -101,7 +101,10 @@ @foreach ($customAttributes as $attribute) code == 'guest_checkout' && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) { + if ( + $attribute->code == 'guest_checkout' + && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout') + ) { continue; } @@ -116,12 +119,14 @@ } if ($attribute->type == 'file') { - $retVal = (core()->getConfigData('catalog.products.attribute.file_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.file_attribute_upload_size') : '2048' ; + $retVal = (core()->getConfigData('catalog.products.attribute.file_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.file_attribute_upload_size') : '2048'; + array_push($validations, 'size:' . $retVal); } if ($attribute->type == 'image') { - $retVal = (core()->getConfigData('catalog.products.attribute.image_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.image_attribute_upload_size') : '2048' ; + $retVal = (core()->getConfigData('catalog.products.attribute.image_attribute_upload_size')) ? core()->getConfigData('catalog.products.attribute.image_attribute_upload_size') : '2048'; + array_push($validations, 'size:' . $retVal . '|mimes:bmp,jpeg,jpg,png,webp'); } @@ -164,8 +169,8 @@ @include ($typeView) type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')" - @else v-if="errors.has('{{ $attribute->code }}')" @endif> + @if ($attribute->type == 'multiselect') v-if="errors.has('{{ $attribute->code }}[]')" + @else v-if="errors.has('{{ $attribute->code }}')" @endif> @if ($attribute->type == 'multiselect') @{{ errors.first('{!! $attribute->code !!}[]') }} @else diff --git a/packages/Webkul/Admin/src/Resources/views/configuration/dependent-field-type.blade.php b/packages/Webkul/Admin/src/Resources/views/configuration/dependent-field-type.blade.php index 991f83368..b9c662990 100644 --- a/packages/Webkul/Admin/src/Resources/views/configuration/dependent-field-type.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/configuration/dependent-field-type.blade.php @@ -91,7 +91,7 @@ if (dependValue == 'true') { dependValue = 1; - } elseif (dependValue == 'false') { + } else if (dependValue == 'false') { dependValue = 0; } diff --git a/packages/Webkul/Admin/src/Resources/views/customers/addresses/create.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/addresses/create.blade.php index 49c422879..926d824eb 100644 --- a/packages/Webkul/Admin/src/Resources/views/customers/addresses/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/customers/addresses/create.blade.php @@ -66,7 +66,10 @@ @{{ errors.first('address1[]') }} - @if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) + @if ( + core()->getConfigData('customer.settings.address.street_lines') + && core()->getConfigData('customer.settings.address.street_lines') > 1 + )
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) diff --git a/packages/Webkul/Admin/src/Resources/views/customers/addresses/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/addresses/edit.blade.php index 9df74c3ef..5f16b0cad 100644 --- a/packages/Webkul/Admin/src/Resources/views/customers/addresses/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/customers/addresses/edit.blade.php @@ -69,7 +69,10 @@ @{{ errors.first('address1[]') }}
- @if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) + @if ( + core()->getConfigData('customer.settings.address.street_lines') + && core()->getConfigData('customer.settings.address.street_lines') > 1 + )
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) diff --git a/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php index 8faa86e15..6c6ca65ce 100755 --- a/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/customers/country-state.blade.php @@ -67,8 +67,9 @@ methods: { haveStates: function () { - if (this.countryStates[this.country] && this.countryStates[this.country].length) + if (this.countryStates[this.country] && this.countryStates[this.country].length) { return true; + } return false; }, diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php index 46084092f..4560c504c 100755 --- a/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/master.blade.php @@ -120,15 +120,15 @@ count = count + moveDown; $('.navbar-left').css("top", count + "px"); - } elseif ((event.keyCode == 40) && count >= -differenceInHeight) { + } else if ((event.keyCode == 40) && count >= -differenceInHeight) { count = count + moveUp; $('.navbar-left').css("top", count + "px"); - } elseif ((event.keyCode == 33) && countKeyUp <= 0) { + } else if ((event.keyCode == 33) && countKeyUp <= 0) { countKeyUp = countKeyUp + pageDown; $('.navbar-left').css("top", countKeyUp + "px"); - } elseif ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) { + } else if ((event.keyCode == 34) && countKeyUp >= -differenceInHeight) { countKeyUp = countKeyUp + pageUp; $('.navbar-left').css("top", countKeyUp + "px"); diff --git a/packages/Webkul/Admin/src/Resources/views/layouts/mobile-nav.blade.php b/packages/Webkul/Admin/src/Resources/views/layouts/mobile-nav.blade.php index 7d0d74957..7c4a8b5fc 100644 --- a/packages/Webkul/Admin/src/Resources/views/layouts/mobile-nav.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/layouts/mobile-nav.blade.php @@ -134,12 +134,11 @@ if (toggle) { toggle.addEventListener("click", () => { - if (nav.classList.contains("is-active")) { - nav.classList.remove("is-active"); - } - else { - nav.classList.add("is-active"); - } + if (nav.classList.contains("is-active")) { + nav.classList.remove("is-active"); + } else { + nav.classList.add("is-active"); + } }); nav.addEventListener("blur", () => { diff --git a/packages/Webkul/Admin/src/Resources/views/sales/invoices/create.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/invoices/create.blade.php index 6eea8120e..54fde9f72 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/invoices/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/invoices/create.blade.php @@ -111,7 +111,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php index 5856b178e..977d92b8b 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/invoices/view.blade.php @@ -139,7 +139,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php index 863c6bf75..6fc4549d8 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/orders/view.blade.php @@ -25,13 +25,19 @@
{!! view_render_event('sales.order.page_action.before', ['order' => $order]) !!} - @if ($order->canCancel() && bouncer()->hasPermission('sales.orders.cancel')) + @if ( + $order->canCancel() + && bouncer()->hasPermission('sales.orders.cancel') + ) {{ __('admin::app.sales.orders.cancel-btn-title') }} @endif - @if ($order->canInvoice() && $order->payment->method !== 'paypal_standard') + @if ( + $order->canInvoice() + && $order->payment->method !== 'paypal_standard' + ) {{ __('admin::app.sales.orders.invoice-btn-title') }} @@ -139,7 +145,10 @@ {!! view_render_event('sales.order.customer_email.after', ['order' => $order]) !!} - @if (! is_null($order->customer) && ! is_null($order->customer->group)) + @if ( + ! is_null($order->customer) + && ! is_null($order->customer->group) + )
{{ __('admin::app.customers.customers.customer_group') }} @@ -159,7 +168,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/refunds/create.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/refunds/create.blade.php index 1c8c418dd..8b248ccac 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/refunds/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/refunds/create.blade.php @@ -110,7 +110,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/refunds/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/refunds/view.blade.php index 492342cdd..33e7c540c 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/refunds/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/refunds/view.blade.php @@ -107,7 +107,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
diff --git a/packages/Webkul/Admin/src/Resources/views/sales/shipments/create.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/shipments/create.blade.php index f5a4e0f41..68526eac8 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/shipments/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/shipments/create.blade.php @@ -110,7 +110,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
@@ -270,7 +273,10 @@ @foreach ($order->items as $item) - @if ($item->qty_to_ship > 0 && $item->product) + @if ( + $item->qty_to_ship > 0 + && $item->product + ) {{ $item->getTypeInstance()->getOrderedItem($item)->sku }} diff --git a/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php b/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php index 422430ed3..a20b3a678 100755 --- a/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/sales/shipments/view.blade.php @@ -106,7 +106,10 @@
- @if ($order->billing_address || $order->shipping_address) + @if ( + $order->billing_address + || $order->shipping_address + )
@@ -199,7 +202,10 @@
- @if ($shipment->inventory_source || $shipment->inventory_source_name) + @if ( + $shipment->inventory_source + || $shipment->inventory_source_name + )
{{ __('admin::app.sales.shipments.inventory-source') }} diff --git a/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php index a53a909a6..2af1324ac 100755 --- a/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/settings/locales/edit.blade.php @@ -66,7 +66,10 @@
- @if (isset($locale) && $locale->locale_image) + @if ( + isset($locale) + && $locale->locale_image + ) tableName && $this->id && $this->tableName === 'category_translations') { + if ( + $this->tableName + && $this->id + && $this->tableName === 'category_translations' + ) { return CategoryTranslationProxy::modelClass()::where('category_id', '<>', $this->id) ->where('slug', $slug) ->limit(1) @@ -109,7 +113,11 @@ class ProductCategoryUniqueSlug implements Rule */ protected function isSlugExistsInProducts($slug) { - if ($this->tableName && $this->id && $this->tableName === 'product_flat') { + if ( + $this->tableName + && $this->id + && $this->tableName === 'product_flat' + ) { return ProductFlatProxy::modelClass()::where('product_id', '<>', $this->id) ->where('url_key', $slug) ->limit(1) diff --git a/packages/Webkul/Attribute/src/Models/AttributeOption.php b/packages/Webkul/Attribute/src/Models/AttributeOption.php index 5847f24bf..7194103ea 100755 --- a/packages/Webkul/Attribute/src/Models/AttributeOption.php +++ b/packages/Webkul/Attribute/src/Models/AttributeOption.php @@ -37,7 +37,10 @@ class AttributeOption extends TranslatableModel implements AttributeOptionContra */ public function swatch_value_url() { - if ($this->swatch_value && $this->attribute->swatch_type == 'image') { + if ( + $this->swatch_value + && $this->attribute->swatch_type == 'image' + ) { return url('cache/small/' . $this->swatch_value); } diff --git a/packages/Webkul/Attribute/src/Repositories/AttributeFamilyRepository.php b/packages/Webkul/Attribute/src/Repositories/AttributeFamilyRepository.php index ee816ead4..c9b69c445 100755 --- a/packages/Webkul/Attribute/src/Repositories/AttributeFamilyRepository.php +++ b/packages/Webkul/Attribute/src/Repositories/AttributeFamilyRepository.php @@ -152,7 +152,10 @@ class AttributeFamilyRepository extends Repository $trimmed = []; foreach ($attributeFamilies as $key => $attributeFamily) { - if ($attributeFamily->name != null || $attributeFamily->name != "") { + if ( + $attributeFamily->name != null + || $attributeFamily->name != "" + ) { $trimmed[$key] = [ 'id' => $attributeFamily->id, 'code' => $attributeFamily->code, diff --git a/packages/Webkul/Attribute/src/Repositories/AttributeOptionRepository.php b/packages/Webkul/Attribute/src/Repositories/AttributeOptionRepository.php index 65008d197..f2ce2c601 100755 --- a/packages/Webkul/Attribute/src/Repositories/AttributeOptionRepository.php +++ b/packages/Webkul/Attribute/src/Repositories/AttributeOptionRepository.php @@ -52,7 +52,10 @@ class AttributeOptionRepository extends Repository */ public function uploadSwatchImage($data, $optionId) { - if (! isset($data['swatch_value']) || ! $data['swatch_value']) { + if ( + ! isset($data['swatch_value']) + || ! $data['swatch_value'] + ) { return; } diff --git a/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php b/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php index 0892ad78a..cc8d32243 100755 --- a/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php +++ b/packages/Webkul/Attribute/src/Repositories/AttributeRepository.php @@ -51,7 +51,10 @@ class AttributeRepository extends Repository $attribute = $this->model->create($data); - if (in_array($attribute->type, ['select', 'multiselect', 'checkbox']) && count($options)) { + if ( + in_array($attribute->type, ['select', 'multiselect', 'checkbox']) + && count($options) + ) { foreach ($options as $optionInputs) { $this->attributeOptionRepository->create(array_merge([ 'attribute_id' => $attribute->id, @@ -169,7 +172,10 @@ class AttributeRepository extends Repository { $attributeColumns = ['id', 'code', 'value_per_channel', 'value_per_locale', 'type', 'is_filterable']; - if (! is_array($codes) && ! $codes) + if ( + ! is_array($codes) + && ! $codes + ) return $this->findWhereIn('code', [ 'name', 'description', diff --git a/packages/Webkul/BookingProduct/src/Helpers/Booking.php b/packages/Webkul/BookingProduct/src/Helpers/Booking.php index bf8a31ff0..9d73cd3d4 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/Booking.php +++ b/packages/Webkul/BookingProduct/src/Helpers/Booking.php @@ -173,7 +173,10 @@ class Booking $date = clone $currentTime; $date->addDays($i); - if ($date >= $availableFrom && $date <= $availableTo) { + if ( + $date >= $availableFrom + && $date <= $availableTo + ) { $days[$i] = $date->format('l'); } } @@ -235,7 +238,10 @@ class Booking { $bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id); - if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) { + if ( + ! is_array($bookingProductSlot->slots) + || ! count($bookingProductSlot->slots) + ) { return []; } @@ -255,7 +261,8 @@ class Booking ? $bookingProductSlot->slots : ($bookingProductSlot->slots[$requestedDate->format('w')] ?? []); - if ($requestedDate < $availableFrom + if ( + $requestedDate < $availableFrom || $requestedDate > $availableTo ) { return []; @@ -289,17 +296,32 @@ class Booking $to = clone $tempStartDayTime; - if (($startDayTime <= $from && $from <= $availableTo) - && ($availableTo >= $to && $to >= $startDayTime) - && ($startDayTime <= $from && $from <= $endDayTime) - && ($endDayTime >= $to && $to >= $startDayTime) + if ( + ($startDayTime <= $from + && $from <= $availableTo + ) + && ( + $availableTo >= $to + && $to >= $startDayTime + ) + && ( + $startDayTime <= $from + && $from <= $endDayTime + ) + && ( + $endDayTime >= $to + && $to >= $startDayTime + ) ) { // Get already ordered qty for this slot $orderedQty = 0; $qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1; - if ($qty && $currentTime <= $from) { + if ( + $qty + && $currentTime <= $from + ) { $slots[] = [ 'from' => $from->format('h:i A'), 'to' => $to->format('h:i A'), @@ -324,7 +346,10 @@ class Booking { $bookingProduct = $this->bookingProductRepository->findOneByField('product_id', $cartItem['product_id']); - if ($bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity'] || $this->isSlotExpired($cartItem)) { + if ( + $bookingProduct->qty - $this->getBookedQuantity($cartItem) < $cartItem['quantity'] + || $this->isSlotExpired($cartItem) + ) { return false; } diff --git a/packages/Webkul/BookingProduct/src/Helpers/DefaultSlot.php b/packages/Webkul/BookingProduct/src/Helpers/DefaultSlot.php index 30d7786c7..e838a05c2 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/DefaultSlot.php +++ b/packages/Webkul/BookingProduct/src/Helpers/DefaultSlot.php @@ -22,7 +22,10 @@ class DefaultSlot extends Booking { $bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id); - if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) { + if ( + ! is_array($bookingProductSlot->slots) + || ! count($bookingProductSlot->slots) + ) { return []; } @@ -38,7 +41,8 @@ class DefaultSlot extends Booking ? Carbon::createFromTimeString($bookingProduct->available_to) : Carbon::createFromTimeString('2080-01-01 00:00:00'); - if ($requestedDate < $availableFrom + if ( + $requestedDate < $availableFrom || $requestedDate > $availableTo ) { return []; @@ -110,7 +114,10 @@ class DefaultSlot extends Booking $timeDuration = $bookingProductSlot->slots[$requestedDate->format('w')] ?? []; - if (! count($timeDuration) || ! $timeDuration['status']) { + if ( + ! count($timeDuration) + || ! $timeDuration['status'] + ) { return []; } @@ -141,17 +148,33 @@ class DefaultSlot extends Booking $to = clone $tempStartDayTime; - if (($startDayTime <= $from && $from <= $availableTo) - && ($availableTo >= $to && $to >= $startDayTime) - && ($startDayTime <= $from && $from <= $endDayTime) - && ($endDayTime >= $to && $to >= $startDayTime) + if ( + ( + $startDayTime <= $from + && $from <= $availableTo + ) + && ( + $availableTo >= $to + && $to >= $startDayTime + ) + && ( + $startDayTime <= $from + && $from <= $endDayTime + ) + && ( + $endDayTime >= $to + && $to >= $startDayTime + ) ) { // Get already ordered qty for this slot $orderedQty = 0; $qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1; - if ($qty && $currentTime <= $from) { + if ( + $qty + && $currentTime <= $from + ) { $slots[] = [ 'from' => $from->format('h:i A'), 'to' => $to->format('h:i A'), diff --git a/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php b/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php index e48f6b2f8..4d4b6c1c1 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php +++ b/packages/Webkul/BookingProduct/src/Helpers/RentalSlot.php @@ -21,7 +21,10 @@ class RentalSlot extends Booking { $bookingProductSlot = $this->typeRepositories[$bookingProduct->type]->findOneByField('booking_product_id', $bookingProduct->id); - if (! is_array($bookingProductSlot->slots) || ! count($bookingProductSlot->slots)) { + if ( + ! is_array($bookingProductSlot->slots) + || ! count($bookingProductSlot->slots) + ) { return []; } @@ -41,7 +44,8 @@ class RentalSlot extends Booking ? $bookingProductSlot->slots : $bookingProductSlot->slots[$requestedDate->format('w')] ?? []; - if ($requestedDate < $availableFrom + if ( + $requestedDate < $availableFrom || $requestedDate > $availableTo ) { return []; @@ -66,17 +70,33 @@ class RentalSlot extends Booking $to = clone $tempStartDayTime; - if (($startDayTime <= $from && $from <= $availableTo) - && ($availableTo >= $to && $to >= $startDayTime) - && ($startDayTime <= $from && $from <= $endDayTime) - && ($endDayTime >= $to && $to >= $startDayTime) + if ( + ( + $startDayTime <= $from + && $from <= $availableTo + ) + && ( + $availableTo >= $to + && $to >= $startDayTime + ) + && ( + $startDayTime <= $from + && $from <= $endDayTime + ) + && ( + $endDayTime >= $to + && $to >= $startDayTime + ) ) { // Get already ordered qty for this slot $orderedQty = 0; $qty = isset($timeDuration['qty']) ? ( $timeDuration['qty'] - $orderedQty ) : 1; - if ($qty && $currentTime <= $from) { + if ( + $qty + && $currentTime <= $from + ) { if (! isset($slots[$index])) { $slots[$index]['time'] = $startDayTime->format('h:i A') . ' - ' . $endDayTime->format('h:i A'); } @@ -174,7 +194,8 @@ class RentalSlot extends Booking ? Carbon::createFromTimeString($bookingProduct->available_to->format('Y-m-d') . ' 23:59:59') : Carbon::createFromTimeString('2080-01-01 00:00:00'); - if ($requestedFromDate < $availableFrom + if ( + $requestedFromDate < $availableFrom || $requestedFromDate > $availableTo || $requestedToDate < $availableFrom || $requestedToDate > $availableTo @@ -242,7 +263,8 @@ class RentalSlot extends Booking $rentingType = $item->additional['booking']['renting_type'] ?? $bookingProduct->rental_slot->renting_type; if ($rentingType == 'daily') { - if (! isset($item->additional['booking']['date_from']) + if ( + ! isset($item->additional['booking']['date_from']) || ! isset($item->additional['booking']['date_to']) ) { $result->itemIsInactive(); @@ -255,7 +277,8 @@ class RentalSlot extends Booking $price += $bookingProduct->rental_slot->daily_price * $to->diffInDays($from); } else { - if (! isset($item->additional['booking']['slot']['from']) + if ( + ! isset($item->additional['booking']['slot']['from']) || ! isset($item->additional['booking']['slot']['to']) ) { $result->itemIsInactive(); diff --git a/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php b/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php index 6862b0e03..0748265fe 100644 --- a/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php +++ b/packages/Webkul/BookingProduct/src/Helpers/TableSlot.php @@ -22,7 +22,10 @@ class TableSlot extends Booking $bookedQty *= $bookingProduct->table_slot->guest_limit; } - if ($bookingProduct->qty - $bookedQty < $requestedQty || $this->isSlotExpired($cartItem)) { + if ( + $bookingProduct->qty - $bookedQty < $requestedQty + || $this->isSlotExpired($cartItem) + ) { return false; } diff --git a/packages/Webkul/BookingProduct/src/Repositories/BookingProductRepository.php b/packages/Webkul/BookingProduct/src/Repositories/BookingProductRepository.php index 826a2d32e..587b02067 100644 --- a/packages/Webkul/BookingProduct/src/Repositories/BookingProductRepository.php +++ b/packages/Webkul/BookingProduct/src/Repositories/BookingProductRepository.php @@ -115,7 +115,10 @@ class BookingProductRepository extends Repository */ public function formatSlots($data) { - if (isset($data['same_slot_all_days']) && ! $data['same_slot_all_days']) { + if ( + isset($data['same_slot_all_days']) + && ! $data['same_slot_all_days'] + ) { for ($i = 0; $i < 7; $i++) { if (! isset($data['slots'][$i])) { $data['slots'][$i] = []; @@ -183,8 +186,15 @@ class BookingProductRepository extends Repository $isOverLapping = false; foreach ($tempSlots as $slot) { - if (($slot['from'] <= $from && $slot['to'] >= $from) - || ($slot['from'] <= $to && $slot['to'] >= $to) + if ( + ( + $slot['from'] <= $from + && $slot['to'] >= $from + ) + || ( + $slot['from'] <= $to + && $slot['to'] >= $to + ) ) { $isOverLapping = true; diff --git a/packages/Webkul/BookingProduct/src/Repositories/BookingRepository.php b/packages/Webkul/BookingProduct/src/Repositories/BookingRepository.php index 4c02bf5b5..09f3b1f74 100644 --- a/packages/Webkul/BookingProduct/src/Repositories/BookingRepository.php +++ b/packages/Webkul/BookingProduct/src/Repositories/BookingRepository.php @@ -37,7 +37,10 @@ class BookingRepository extends Repository $from = $to = null; if (isset($item->additional['booking']['slot'])) { - if (isset($item->additional['booking']['slot']['from']) && isset($item->additional['booking']['slot']['to'])) { + if ( + isset($item->additional['booking']['slot']['from']) + && isset($item->additional['booking']['slot']['to']) + ) { $from = $item->additional['booking']['slot']['from']; $to = $item->additional['booking']['slot']['to']; @@ -48,7 +51,10 @@ class BookingRepository extends Repository $to = end($timestamps); } - } elseif (isset($item->additional['booking']['date_from']) && isset($item->additional['booking']['date_to'])) { + } elseif ( + isset($item->additional['booking']['date_from']) + && isset($item->additional['booking']['date_to']) + ) { $from = Carbon::createFromTimeString($item->additional['booking']['date_from'] . ' 00:00:00')->getTimestamp(); $to = Carbon::createFromTimeString($item->additional['booking']['date_to'] . ' 23:59:59')->getTimestamp(); diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/default.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/default.blade.php index bb98c0c42..c87c928be 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/default.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/default.blade.php @@ -241,8 +241,9 @@ if (this.default_booking.booking_type == 'one') { this.slots['one'] = this.default_booking.slots ? this.default_booking.slots : []; } else { - if (this.default_booking.slots) + if (this.default_booking.slots) { this.slots['many'] = this.default_booking.slots; + } } }, diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/event.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/event.blade.php index 1635fa7a2..90bb21420 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/event.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/event.blade.php @@ -170,8 +170,9 @@ computed: { controlName: function () { - if (this.ticketItem.id) + if (this.ticketItem.id) { return 'booking[tickets][' + this.ticketItem.id + ']'; + } return 'booking[tickets][ticket_' + this.index + ']'; } diff --git a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/slots.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/slots.blade.php index 9bd0de0ec..d2500bf74 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/slots.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/admin/catalog/products/accordians/booking/slots.blade.php @@ -136,8 +136,9 @@ }, created: function() { - if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots) + if (! bookingProduct || ! bookingProduct[this.bookingType].slots || ! bookingProduct[this.bookingType].slots) { return; + } if (bookingProduct[this.bookingType].same_slot_all_days) { this.slots['same_for_week'] = bookingProduct[this.bookingType].slots; @@ -149,8 +150,9 @@ methods: { addSlot: function (dayIndex = null) { if (dayIndex !== null) { - if (this.slots['different_for_week'][dayIndex] == undefined) + if (this.slots['different_for_week'][dayIndex] == undefined) { this.slots['different_for_week'][dayIndex] = []; + } var slot = { 'from': '', diff --git a/packages/Webkul/BookingProduct/src/Resources/views/shop/default/products/view/booking/table.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/shop/default/products/view/booking/table.blade.php index 1c517879a..8c3ed092e 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/shop/default/products/view/booking/table.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/shop/default/products/view/booking/table.blade.php @@ -36,7 +36,10 @@ {{ $day['name'] }} - @if ($day['slots'] && count($day['slots'])) + @if ( + $day['slots'] + && count($day['slots']) + ) @foreach ($day['slots'] as $slot) {{ $slot['from'] . ' - ' . $slot['to'] }}
@endforeach diff --git a/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/appointment.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/appointment.blade.php index ed31c4cab..5ca322f36 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/appointment.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/appointment.blade.php @@ -36,7 +36,10 @@ {{ $day['name'] }} - @if ($day['slots'] && count($day['slots'])) + @if ( + $day['slots'] + && count($day['slots']) + ) @foreach ($day['slots'] as $slot) {{ $slot['from'] . ' - ' . $slot['to'] }}
@endforeach diff --git a/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/table.blade.php b/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/table.blade.php index 7291e5550..af31f6ecb 100644 --- a/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/table.blade.php +++ b/packages/Webkul/BookingProduct/src/Resources/views/shop/velocity/products/view/booking/table.blade.php @@ -36,7 +36,10 @@ {{ $day['name'] }} - @if ($day['slots'] && count($day['slots'])) + @if ( + $day['slots'] + && count($day['slots']) + ) @foreach ($day['slots'] as $slot) {{ $slot['from'] . ' - ' . $slot['to'] }}
@endforeach diff --git a/packages/Webkul/BookingProduct/src/Type/Booking.php b/packages/Webkul/BookingProduct/src/Type/Booking.php index 4c11c7504..38e67f8a0 100644 --- a/packages/Webkul/BookingProduct/src/Type/Booking.php +++ b/packages/Webkul/BookingProduct/src/Type/Booking.php @@ -161,7 +161,10 @@ class Booking extends Virtual */ public function prepareForCart($data) { - if (! isset($data['booking']) || ! count($data['booking'])) { + if ( + ! isset($data['booking']) + || ! count($data['booking']) + ) { return trans('shop::app.checkout.cart.integrity.missing_options'); } @@ -170,7 +173,10 @@ class Booking extends Virtual $bookingProduct = $this->getBookingProduct($data['product_id']); if ($bookingProduct->type == 'event') { - if (Carbon::now() > $bookingProduct->available_from && Carbon::now() > $bookingProduct->available_to) { + if ( + Carbon::now() > $bookingProduct->available_from + && Carbon::now() > $bookingProduct->available_to + ) { return trans('shop::app.checkout.cart.event.expired'); } @@ -225,10 +231,12 @@ class Booking extends Virtual return false; } - if (isset($options1['booking'], $options2['booking']) + if ( + isset($options1['booking'], $options2['booking']) && isset($options1['booking']['ticket_id'], $options2['booking']['ticket_id']) - && $options1['booking']['ticket_id'] === $options2['booking']['ticket_id']) { - return true; + && $options1['booking']['ticket_id'] === $options2['booking']['ticket_id'] + ) { + return true; } return false; diff --git a/packages/Webkul/CartRule/src/Helpers/CartRule.php b/packages/Webkul/CartRule/src/Helpers/CartRule.php index 4843f68a4..f8c074c82 100644 --- a/packages/Webkul/CartRule/src/Helpers/CartRule.php +++ b/packages/Webkul/CartRule/src/Helpers/CartRule.php @@ -60,7 +60,10 @@ class CartRule $appliedCartRuleIds = array_merge($appliedCartRuleIds, $itemCartRuleIds); - if ($item->children()->count() && $item->product->getTypeInstance()->isChildrenCalculated()) { + if ( + $item->children()->count() + && $item->product->getTypeInstance()->isChildrenCalculated() + ) { $this->divideDiscount($item); } } @@ -91,7 +94,10 @@ class CartRule public static $cartID; }; - if ($staticCartRules::$cartID === $cart->id && $staticCartRules::$cartRules) { + if ( + $staticCartRules::$cartID === $cart->id + && $staticCartRules::$cartRules + ) { return $staticCartRules::$cartRules; } @@ -132,18 +138,30 @@ class CartRule // reasons (cart_rule_coupon-relation is pre-loaded by self::getCartRuleQuery()) $coupon = $rule->cart_rule_coupon()->where('code', $cart->coupon_code)->first(); - if ($coupon && $coupon->code === $cart->coupon_code) { - if ($coupon->usage_limit && $coupon->times_used >= $coupon->usage_limit) { + if ( + $coupon + && $coupon->code === $cart->coupon_code + ) { + if ( + $coupon->usage_limit + && $coupon->times_used >= $coupon->usage_limit + ) { return false; } - if ($cart->customer_id && $coupon->usage_per_customer) { + if ( + $cart->customer_id + && $coupon->usage_per_customer + ) { $couponUsage = $this->cartRuleCouponUsageRepository->findOneWhere([ 'cart_rule_coupon_id' => $coupon->id, 'customer_id' => $cart->customer_id, ]); - if ($couponUsage && $couponUsage->times_used >= $coupon->usage_per_customer) { + if ( + $couponUsage + && $couponUsage->times_used >= $coupon->usage_per_customer + ) { return false; } } @@ -161,7 +179,10 @@ class CartRule 'customer_id' => $cart->customer_id, ]); - if ($ruleCustomer && $ruleCustomer->times_used >= $rule->usage_per_customer) { + if ( + $ruleCustomer + && $ruleCustomer->times_used >= $rule->usage_per_customer + ) { return false; } } @@ -209,7 +230,10 @@ class CartRule $baseDiscountAmount = ($quantity * $item->base_price + $item->base_tax_amount - $item->base_discount_amount) * ($rulePercent / 100); - if (! $rule->discount_quantity || $rule->discount_quantity > $quantity) { + if ( + ! $rule->discount_quantity + || $rule->discount_quantity > $quantity + ) { $discountPercent = min(100, $item->discount_percent + $rulePercent); $item->discount_percent = $discountPercent; @@ -242,7 +266,10 @@ class CartRule break; case 'buy_x_get_y': - if (! $rule->discount_step || $rule->discount_amount > $rule->discount_step) { + if ( + ! $rule->discount_step + || $rule->discount_amount > $rule->discount_step + ) { break; } @@ -314,7 +341,10 @@ class CartRule continue; } - if (! $rule || ! $rule->apply_to_shipping) { + if ( + ! $rule + || ! $rule->apply_to_shipping + ) { continue; } @@ -400,7 +430,10 @@ class CartRule continue; } - if (! $rule || ! $rule->free_shipping) { + if ( + ! $rule + || ! $rule->free_shipping + ) { continue; } diff --git a/packages/Webkul/CartRule/src/Models/CartRule.php b/packages/Webkul/CartRule/src/Models/CartRule.php index 73136722b..3addf91ce 100644 --- a/packages/Webkul/CartRule/src/Models/CartRule.php +++ b/packages/Webkul/CartRule/src/Models/CartRule.php @@ -124,7 +124,7 @@ class CartRule extends Model implements CartRuleContract $coupon = $this->coupon_code() ->first(); - if (!$coupon) { + if (! $coupon) { return; } diff --git a/packages/Webkul/CartRule/src/Repositories/CartRuleRepository.php b/packages/Webkul/CartRule/src/Repositories/CartRuleRepository.php index 9e8038301..454134bdb 100755 --- a/packages/Webkul/CartRule/src/Repositories/CartRuleRepository.php +++ b/packages/Webkul/CartRule/src/Repositories/CartRuleRepository.php @@ -71,7 +71,10 @@ class CartRuleRepository extends Repository $cartRule->customer_groups()->sync($data['customer_groups']); - if ($data['coupon_type'] && ! $data['use_auto_generation']) { + if ( + $data['coupon_type'] + && ! $data['use_auto_generation'] + ) { $this->cartRuleCouponRepository->create([ 'cart_rule_id' => $cartRule->id, 'code' => $data['coupon_code'], diff --git a/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProduct.php b/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProduct.php index bc9025350..076a7b912 100644 --- a/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProduct.php +++ b/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProduct.php @@ -106,7 +106,8 @@ class CatalogRuleProduct $appliedAttributes = []; foreach ($rule->conditions as $condition) { - if (! $condition['attribute'] + if ( + ! $condition['attribute'] || ! isset($condition['value']) || is_null($condition['value']) || $condition['value'] == '' diff --git a/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProductPrice.php b/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProductPrice.php index e01f98c27..f58574b2a 100644 --- a/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProductPrice.php +++ b/packages/Webkul/CatalogRule/src/Helpers/CatalogRuleProductPrice.php @@ -48,7 +48,10 @@ class CatalogRuleProductPrice foreach ($catalogRuleProducts as $row) { $productKey = $row->product_id . '-' . $row->channel_id . '-' . $row->customer_group_id; - if ($previousKey && $previousKey != $productKey) { + if ( + $previousKey + && $previousKey != $productKey + ) { $endRuleFlags = []; if (count($prices) > $batchCount) { @@ -59,8 +62,15 @@ class CatalogRuleProductPrice } foreach ($dates as $key => $date) { - if ((! $row->starts_from || $date >= $row->starts_from) - && (! $row->ends_till || $date <= $row->ends_till) + if ( + ( + ! $row->starts_from + || $date >= $row->starts_from + ) + && ( + ! $row->ends_till + || $date <= $row->ends_till + ) ) { $priceKey = $date->getTimestamp() . '-' . $productKey; diff --git a/packages/Webkul/Category/src/Http/Controllers/CategoryController.php b/packages/Webkul/Category/src/Http/Controllers/CategoryController.php index cfc99bf1b..34b2831bc 100755 --- a/packages/Webkul/Category/src/Http/Controllers/CategoryController.php +++ b/packages/Webkul/Category/src/Http/Controllers/CategoryController.php @@ -175,7 +175,10 @@ class CategoryController extends Controller } } - if (count($categoryIds) != 1 || $suppressFlash == true) { + if ( + count($categoryIds) != 1 + || $suppressFlash == true + ) { session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'Category'])); } diff --git a/packages/Webkul/Category/src/Repositories/CategoryRepository.php b/packages/Webkul/Category/src/Repositories/CategoryRepository.php index 700413a33..a858ba4e0 100755 --- a/packages/Webkul/Category/src/Repositories/CategoryRepository.php +++ b/packages/Webkul/Category/src/Repositories/CategoryRepository.php @@ -31,7 +31,10 @@ class CategoryRepository extends Repository { Event::dispatch('catalog.category.create.before'); - if (isset($data['locale']) && $data['locale'] == 'all') { + if ( + isset($data['locale']) + && $data['locale'] == 'all' + ) { $model = app()->make($this->model()); foreach (core()->getAllLocales() as $locale) { @@ -268,7 +271,10 @@ class CategoryRepository extends Repository $trimmed = []; foreach ($categories as $key => $category) { - if ($category->name != null || $category->name != '') { + if ( + $category->name != null + || $category->name != '' + ) { $trimmed[$key] = [ 'id' => $category->id, 'name' => $category->name, diff --git a/packages/Webkul/Checkout/src/Cart.php b/packages/Webkul/Checkout/src/Cart.php index 0f0f7665f..28dedceeb 100755 --- a/packages/Webkul/Checkout/src/Cart.php +++ b/packages/Webkul/Checkout/src/Cart.php @@ -152,7 +152,10 @@ class Cart $cart = $this->getCart(); - if (! $cart && ! $cart = $this->create($data)) { + if ( + ! $cart + && ! $cart = $this->create($data) + ) { return ['warning' => __('shop::app.checkout.cart.item.error-add')]; } @@ -185,7 +188,10 @@ class Cart if (! $cartItem) { $cartItem = $this->cartItemRepository->create(array_merge($cartProduct, ['cart_id' => $cart->id])); } else { - if (isset($cartProduct['parent_id']) && $cartItem->parent_id !== $parentCartItem->id) { + if ( + isset($cartProduct['parent_id']) + && $cartItem->parent_id !== $parentCartItem->id + ) { $cartItem = $this->cartItemRepository->create(array_merge($cartProduct, [ 'cart_id' => $cart->id, ])); @@ -271,7 +277,10 @@ class Cart continue; } - if ($item->product && $item->product->status === 0) { + if ( + $item->product + && $item->product->status === 0 + ) { throw new Exception(__('shop::app.checkout.cart.item.inactive')); } @@ -408,7 +417,8 @@ class Cart if ( auth()->guard()->check() && ($user = auth()->guard()->user()) - && ($user->email + && ( + $user->email && $user->first_name && $user->last_name @@ -739,7 +749,10 @@ class Cart 'additional' => is_array($data['additional']) ? array_merge($data['additional'], $locale) : $locale, ]; - if (isset($data['children']) && $data['children']) { + if ( + isset($data['children']) + && $data['children'] + ) { foreach ($data['children'] as $child) { /** * - For bundle, child quantity will not be zero. @@ -856,11 +869,17 @@ class Cart ): void { $shippingAddress['cart_id'] = $billingAddress['cart_id'] = null; - if (isset($data['billing']['save_as_address']) && $data['billing']['save_as_address']) { + if ( + isset($data['billing']['save_as_address']) + && $data['billing']['save_as_address'] + ) { $this->customerAddressRepository->create($billingAddress); } - if (isset($data['shipping']['save_as_address']) && $data['shipping']['save_as_address']) { + if ( + isset($data['shipping']['save_as_address']) + && $data['shipping']['save_as_address'] + ) { $this->customerAddressRepository->create($shippingAddress); } } @@ -876,7 +895,10 @@ class Cart { $customerAddress = []; - if (isset($data['billing']['address_id']) && $data['billing']['address_id']) { + if ( + isset($data['billing']['address_id']) + && $data['billing']['address_id'] + ) { $customerAddress = $this ->customerAddressRepository ->findOneWhere(['id' => $data['billing']['address_id']]) @@ -905,7 +927,10 @@ class Cart { $customerAddress = []; - if (isset($data['shipping']['address_id']) && $data['shipping']['address_id']) { + if ( + isset($data['shipping']['address_id']) + && $data['shipping']['address_id'] + ) { $customerAddress = $this ->customerAddressRepository ->findOneWhere(['id' => $data['shipping']['address_id']]) @@ -937,22 +962,33 @@ class Cart array $shippingAddressData ): void { $billingAddressModel = $cart->billing_address; + if ($billingAddressModel) { $billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_BILLING; + $this->cartAddressRepository->update($billingAddressData, $billingAddressModel->id); if ($cart->haveStockableItems()) { $shippingAddressModel = $cart->shipping_address; + if ($shippingAddressModel) { - if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { + if ( + isset($billingAddressData['use_for_shipping']) + && $billingAddressData['use_for_shipping'] + ) { $billingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING; + $this->cartAddressRepository->update($billingAddressData, $shippingAddressModel->id); } else { $shippingAddressData['address_type'] = CartAddress::ADDRESS_TYPE_SHIPPING; + $this->cartAddressRepository->update($shippingAddressData, $shippingAddressModel->id); } } else { - if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { + if ( + isset($billingAddressData['use_for_shipping']) + && $billingAddressData['use_for_shipping'] + ) { $this->cartAddressRepository->create(array_merge( $billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING] @@ -969,7 +1005,10 @@ class Cart $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_BILLING])); if ($cart->haveStockableItems()) { - if (isset($billingAddressData['use_for_shipping']) && $billingAddressData['use_for_shipping']) { + if ( + isset($billingAddressData['use_for_shipping']) + && $billingAddressData['use_for_shipping'] + ) { $this->cartAddressRepository->create(array_merge($billingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); } else { $this->cartAddressRepository->create(array_merge($shippingAddressData, ['address_type' => CartAddress::ADDRESS_TYPE_SHIPPING])); diff --git a/packages/Webkul/Checkout/src/Http/Requests/CustomerAddressForm.php b/packages/Webkul/Checkout/src/Http/Requests/CustomerAddressForm.php index 174d9111c..38240eb2d 100755 --- a/packages/Webkul/Checkout/src/Http/Requests/CustomerAddressForm.php +++ b/packages/Webkul/Checkout/src/Http/Requests/CustomerAddressForm.php @@ -38,7 +38,10 @@ class CustomerAddressForm extends FormRequest $this->mergeNewAddressRules('billing'); } - if (isset($this->get('billing')['use_for_shipping']) && ! $this->get('billing')['use_for_shipping']) { + if ( + isset($this->get('billing')['use_for_shipping']) + && ! $this->get('billing')['use_for_shipping'] + ) { if (isset($this->get('shipping')['address_id'])) { $this->mergeExistingAddressRules('shipping'); } else { diff --git a/packages/Webkul/Core/src/Core.php b/packages/Webkul/Core/src/Core.php index a60d2e039..df528a441 100755 --- a/packages/Webkul/Core/src/Core.php +++ b/packages/Webkul/Core/src/Core.php @@ -489,7 +489,10 @@ class Core { static $exchangeRate; - if ($exchangeRate || $exchangeRate === '') { + if ( + $exchangeRate + || $exchangeRate === '' + ) { return $exchangeRate; } @@ -538,7 +541,11 @@ class Core $exchangeRate = $this->getExchangeRate($targetCurrency->id); - if ('' === $exchangeRate || null === $exchangeRate || ! $exchangeRate->rate) { + if ( + '' === $exchangeRate + || null === $exchangeRate + || ! $exchangeRate->rate + ) { return $amount; } @@ -572,7 +579,10 @@ class Core 'target_currency' => $targetCurrency->id, ]); - if (null === $exchangeRate || ! $exchangeRate->rate) { + if ( + null === $exchangeRate + || ! $exchangeRate->rate + ) { return $amount; } @@ -716,9 +726,15 @@ class Core $toTimeStamp += 86400; } - if (! $this->is_empty_date($dateFrom) && $channelTimeStamp < $fromTimeStamp) { + if ( + ! $this->is_empty_date($dateFrom) + && $channelTimeStamp < $fromTimeStamp + ) { $result = false; - } elseif (! $this->is_empty_date($dateTo) && $channelTimeStamp > $toTimeStamp) { + } elseif ( + ! $this->is_empty_date($dateTo) + && $channelTimeStamp > $toTimeStamp + ) { $result = false; } else { $result = true; @@ -791,7 +807,10 @@ class Core { static $loadedConfigs = []; - if (array_key_exists($field, $loadedConfigs) && ! in_array($field, $this->coreConfigExceptions)) { + if ( + array_key_exists($field, $loadedConfigs) + && ! in_array($field, $this->coreConfigExceptions) + ) { $coreConfigValue = $loadedConfigs[$field]; } else { if (null === $channel) { @@ -1103,7 +1122,10 @@ class Core while (count($keys) > 1) { $key = array_shift($keys); - if (! isset($array[$key]) || ! is_array($array[$key])) { + if ( + ! isset($array[$key]) + || ! is_array($array[$key]) + ) { $array[$key] = []; } @@ -1212,7 +1234,11 @@ class Core $merged = $array1; foreach ($array2 as $key => &$value) { - if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) { + if ( + is_array($value) + && isset($merged[$key]) + && is_array($merged[$key]) + ) { $merged[$key] = $this->arrayMerge($merged[$key], $value); } else { $merged[$key] = $value; @@ -1234,8 +1260,14 @@ class Core { $fields = $this->getConfigField($field); - if (isset($fields['channel_based']) && $fields['channel_based']) { - if (isset($fields['locale_based']) && $fields['locale_based']) { + if ( + isset($fields['channel_based']) + && $fields['channel_based'] + ) { + if ( + isset($fields['locale_based']) + && $fields['locale_based'] + ) { $coreConfigValue = $this->coreConfigRepository->findOneWhere([ 'code' => $field, 'channel_code' => $channel, @@ -1248,7 +1280,10 @@ class Core ]); } } else { - if (isset($fields['locale_based']) && $fields['locale_based']) { + if ( + isset($fields['locale_based']) + && $fields['locale_based'] + ) { $coreConfigValue = $this->coreConfigRepository->findOneWhere([ 'code' => $field, 'locale_code' => $locale, diff --git a/packages/Webkul/Core/src/Helpers/Exchange/ExchangeRates.php b/packages/Webkul/Core/src/Helpers/Exchange/ExchangeRates.php index 9b4c8408d..ba8bb909d 100644 --- a/packages/Webkul/Core/src/Helpers/Exchange/ExchangeRates.php +++ b/packages/Webkul/Core/src/Helpers/Exchange/ExchangeRates.php @@ -57,7 +57,10 @@ class ExchangeRates extends ExchangeRate $result = json_decode($result->getBody()->getContents(), true); - if (isset($result['success']) && ! $result['success']) { + if ( + isset($result['success']) + && ! $result['success'] + ) { throw new \Exception( isset($result['error']['info']) ? $result['error']['info'] diff --git a/packages/Webkul/Core/src/Helpers/Exchange/FixerExchange.php b/packages/Webkul/Core/src/Helpers/Exchange/FixerExchange.php index 346bfe3c0..a46115dff 100644 --- a/packages/Webkul/Core/src/Helpers/Exchange/FixerExchange.php +++ b/packages/Webkul/Core/src/Helpers/Exchange/FixerExchange.php @@ -57,7 +57,10 @@ class FixerExchange extends ExchangeRate $result = json_decode($result->getBody()->getContents(), true); - if (isset($result['success']) && ! $result['success']) { + if ( + isset($result['success']) + && ! $result['success'] + ) { throw new \Exception( isset($result['error']['info']) ? $result['error']['info'] diff --git a/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php b/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php index 980e305e4..ee845d5a8 100755 --- a/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php +++ b/packages/Webkul/Core/src/Repositories/CoreConfigRepository.php @@ -33,7 +33,10 @@ class CoreConfigRepository extends Repository { Event::dispatch('core.configuration.save.before'); - if ($data['locale'] || $data['channel']) { + if ( + $data['locale'] + || $data['channel'] + ) { $locale = $data['locale']; $channel = $data['channel']; @@ -51,12 +54,21 @@ class CoreConfigRepository extends Repository $localeBased = isset($field['locale_based']) && $field['locale_based'] ? true : false; - if (getType($value) == 'array' && ! isset($value['delete'])) { + if ( + getType($value) == 'array' + && ! isset($value['delete']) + ) { $value = implode(',', $value); } - if (isset($field['channel_based']) && $field['channel_based']) { - if (isset($field['locale_based']) && $field['locale_based']) { + if ( + isset($field['channel_based']) + && $field['channel_based'] + ) { + if ( + isset($field['locale_based']) + && $field['locale_based'] + ) { $coreConfigValue = $this->model ->where('code', $fieldName) ->where('locale_code', $locale) @@ -69,7 +81,10 @@ class CoreConfigRepository extends Repository ->get(); } } else { - if (isset($field['locale_based']) && $field['locale_based']) { + if ( + isset($field['locale_based']) + && $field['locale_based'] + ) { $coreConfigValue = $this->model ->where('code', $fieldName) ->where('locale_code', $locale) diff --git a/packages/Webkul/Core/src/Traits/CoreConfigField.php b/packages/Webkul/Core/src/Traits/CoreConfigField.php index 12162b518..c816529ed 100644 --- a/packages/Webkul/Core/src/Traits/CoreConfigField.php +++ b/packages/Webkul/Core/src/Traits/CoreConfigField.php @@ -109,11 +109,17 @@ trait CoreConfigField { $info = []; - if (isset($field['channel_based']) && $field['channel_based']) { + if ( + isset($field['channel_based']) + && $field['channel_based'] + ) { $info[] = $channel; } - if (isset($field['locale_based']) && $field['locale_based']) { + if ( + isset($field['locale_based']) + && $field['locale_based'] + ) { $info[] = $locale; } diff --git a/packages/Webkul/Core/src/Tree.php b/packages/Webkul/Core/src/Tree.php index 08d9d1446..0793597a8 100755 --- a/packages/Webkul/Core/src/Tree.php +++ b/packages/Webkul/Core/src/Tree.php @@ -99,7 +99,10 @@ class Tree { { $url = trim($item['url'], '/'); - if ((strpos($this->current, $url) !== false) || (strpos($this->currentKey, $item['key']) === 0)) { + if ( + (strpos($this->current, $url) !== false) + || (strpos($this->currentKey, $item['key']) === 0) + ) { return 'active'; } } diff --git a/packages/Webkul/Core/src/View/Compilers/BladeCompiler.php b/packages/Webkul/Core/src/View/Compilers/BladeCompiler.php index c664d2b18..f61715a8e 100644 --- a/packages/Webkul/Core/src/View/Compilers/BladeCompiler.php +++ b/packages/Webkul/Core/src/View/Compilers/BladeCompiler.php @@ -16,7 +16,8 @@ class BladeCompiler extends BaseBladeCompiler { $tokens = $this->getOpenAndClosingPhpTokens($contents); - if (config('view.tracer') + if ( + config('view.tracer') && strpos($this->getPath(), 'tracer/style.blade.php') == false && strpos($this->getPath(), 'master.blade.php') == false ) { @@ -25,7 +26,10 @@ class BladeCompiler extends BaseBladeCompiler $contents = '
' . $contents . '
'; } - if ($tokens->isNotEmpty() && $tokens->last() !== T_CLOSE_TAG) { + if ( + $tokens->isNotEmpty() + && $tokens->last() !== T_CLOSE_TAG + ) { $contents .= ' ?>'; } diff --git a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php index 8af558530..4b661844f 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/CustomerController.php @@ -72,14 +72,20 @@ class CustomerController extends Controller $data = $customerProfileRequest->validated(); - if (isset($data['date_of_birth']) && $data['date_of_birth'] == '') { + if ( + isset($data['date_of_birth']) + && $data['date_of_birth'] == '' + ) { unset($data['date_of_birth']); } $data['subscribed_to_news_letter'] = isset($data['subscribed_to_news_letter']) ? 1 : 0; if (isset($data['oldpassword'])) { - if ($data['oldpassword'] != '' || $data['oldpassword'] != null) { + if ( + $data['oldpassword'] != '' + || $data['oldpassword'] != null + ) { if (Hash::check($data['oldpassword'], auth()->guard('customer')->user()->password)) { $isPasswordChanged = true; diff --git a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php index 7a1823b43..27a9ba471 100755 --- a/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php +++ b/packages/Webkul/Customer/src/Http/Controllers/WishlistController.php @@ -88,7 +88,10 @@ class WishlistController extends Controller 'customer_id' => $this->currentCustomer->id, ]); - if ($product->parent && $product->parent->type !== 'configurable') { + if ( + $product->parent + && $product->parent->type !== 'configurable' + ) { $product = $this->productRepository->findOneByField('id', $product->parent_id); $data['product_id'] = $product->id; } @@ -128,7 +131,10 @@ class WishlistController extends Controller $updateCounts = $this->currentCustomer->wishlist_items()->update(['shared' => $data['shared']]); - if ($updateCounts && $updateCounts > 0) { + if ( + $updateCounts + && $updateCounts > 0 + ) { return response()->json([ 'isWishlistShared' => $this->currentCustomer->isWishlistShared(), 'wishlistSharedLink' => $this->currentCustomer->getWishlistSharedLink() @@ -158,7 +164,10 @@ class WishlistController extends Controller $items = $customer->wishlist_items()->where('shared', 1)->get(); - if ($customer && $items->isNotEmpty()) { + if ( + $customer + && $items->isNotEmpty() + ) { return view($this->_config['view'], compact('customer', 'items')); } diff --git a/packages/Webkul/Customer/src/Repositories/CustomerAddressRepository.php b/packages/Webkul/Customer/src/Repositories/CustomerAddressRepository.php index b5232a366..177334847 100755 --- a/packages/Webkul/Customer/src/Repositories/CustomerAddressRepository.php +++ b/packages/Webkul/Customer/src/Repositories/CustomerAddressRepository.php @@ -31,7 +31,10 @@ class CustomerAddressRepository extends Repository ->findWhere(['customer_id' => $data['customer_id'], 'default_address' => 1]) ->first(); - if (isset($default_address->id) && $data['default_address']) { + if ( + isset($default_address->id) + && $data['default_address'] + ) { $default_address->update(['default_address' => 0]); } @@ -59,7 +62,10 @@ class CustomerAddressRepository extends Repository ->findWhere(['customer_id' => $address->customer_id, 'default_address' => 1]) ->first(); - if (isset($default_address->id) && $data['default_address']) { + if ( + isset($default_address->id) + && $data['default_address'] + ) { if ($default_address->id != $address->id) { $default_address->update(['default_address' => 0]); } diff --git a/packages/Webkul/DebugBar/src/DataCollector/ModuleCollector.php b/packages/Webkul/DebugBar/src/DataCollector/ModuleCollector.php index c0e9e64f9..7806ed2e8 100644 --- a/packages/Webkul/DebugBar/src/DataCollector/ModuleCollector.php +++ b/packages/Webkul/DebugBar/src/DataCollector/ModuleCollector.php @@ -79,7 +79,10 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R ? "/\?(?=(?:[^'\\\']*'[^'\\\']*')*[^'\\\']*$)/" : "/:{$key}(?=(?:[^'\\\']*'[^'\\\']*')*[^'\\\']*$)/"; - if (! is_int($binding) && ! is_float($binding)) { + if ( + ! is_int($binding) + && ! is_float($binding) + ) { $binding = $query->connection->getPdo()->quote($binding); } @@ -99,7 +102,10 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R public function checkBindings($bindings) { foreach ($bindings as &$binding) { - if (is_string($binding) && ! mb_check_encoding($binding, 'UTF-8')) { + if ( + is_string($binding) + && ! mb_check_encoding($binding, 'UTF-8') + ) { $binding = '[BINARY DATA]'; } } @@ -135,7 +141,11 @@ class ModuleCollector extends DataCollector implements DataCollectorInterface, R $queries = $this->getQueries($module->getNamespaceRoot()); - if (count($models) || count($views) || count($queries)) { + if ( + count($models) + || count($views) + || count($queries) + ) { $modules[] = [ 'name' => $module->getNamespaceRoot(), 'models' => $models, diff --git a/packages/Webkul/Notification/src/Repositories/NotificationRepository.php b/packages/Webkul/Notification/src/Repositories/NotificationRepository.php index 19ddd9105..7972234da 100644 --- a/packages/Webkul/Notification/src/Repositories/NotificationRepository.php +++ b/packages/Webkul/Notification/src/Repositories/NotificationRepository.php @@ -23,7 +23,10 @@ class NotificationRepository extends Repository */ public function getParamsData($params) { - if (isset($params['id']) && isset($params['status'])) { + if ( + isset($params['id']) + && isset($params['status']) + ) { return $params['status'] != 'All' ? $this->model->where(function($qry) use ($params) { $qry->whereHas('order',function ($q) use ($params) { $q->where(['status' => $params['status']]); @@ -35,7 +38,10 @@ class NotificationRepository extends Repository $q->where(['status' => $params['status']]); }); })->with('order')->paginate(10): $this->model->with('order')->latest()->paginate(10); - } elseif(isset($params['read']) && isset($params['limit'])) { + } elseif( + isset($params['read']) + && isset($params['limit']) + ) { return $this->model->where('read', $params['read'])->limit($params['limit'])->with('order')->latest()->paginate($params['limit']); } elseif(isset($params['limit'])) { return $this->model->limit($params['limit'])->with('order')->latest()->paginate($params['limit']); diff --git a/packages/Webkul/Payment/src/Listeners/GenerateInvoice.php b/packages/Webkul/Payment/src/Listeners/GenerateInvoice.php index 0fdde3689..1eda85851 100644 --- a/packages/Webkul/Payment/src/Listeners/GenerateInvoice.php +++ b/packages/Webkul/Payment/src/Listeners/GenerateInvoice.php @@ -35,12 +35,24 @@ class GenerateInvoice */ public function handle($order) { - if ($order->payment->method == 'cashondelivery' && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')) { - $this->invoiceRepository->create($this->prepareInvoiceData($order), core()->getConfigData('sales.paymentmethods.cashondelivery.invoice_status'), core()->getConfigData('sales.paymentmethods.cashondelivery.order_status')); + if ( + $order->payment->method == 'cashondelivery' + && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice') + ) { + $this->invoiceRepository->create( + $this->prepareInvoiceData($order), + core()->getConfigData('sales.paymentmethods.cashondelivery.invoice_status'), core()->getConfigData('sales.paymentmethods.cashondelivery.order_status') + ); } - if ($order->payment->method == 'moneytransfer' && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')) { - $this->invoiceRepository->create($this->prepareInvoiceData($order), core()->getConfigData('sales.paymentmethods.moneytransfer.invoice_status'), core()->getConfigData('sales.paymentmethods.moneytransfer.order_status')); + if ( + $order->payment->method == 'moneytransfer' + && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice') + ) { + $this->invoiceRepository->create( + $this->prepareInvoiceData($order), + core()->getConfigData('sales.paymentmethods.moneytransfer.invoice_status'), core()->getConfigData('sales.paymentmethods.moneytransfer.order_status') + ); } } diff --git a/packages/Webkul/Payment/src/Payment/MoneyTransfer.php b/packages/Webkul/Payment/src/Payment/MoneyTransfer.php index c9cfac168..8f3199804 100755 --- a/packages/Webkul/Payment/src/Payment/MoneyTransfer.php +++ b/packages/Webkul/Payment/src/Payment/MoneyTransfer.php @@ -23,7 +23,8 @@ class MoneyTransfer extends Payment */ public function getAdditionalDetails() { - if (! $this->getConfigData('mailing_address') + if ( + ! $this->getConfigData('mailing_address') || $this->getConfigData('mailing_address') == '' ) { return []; diff --git a/packages/Webkul/Payment/src/Payment/Payment.php b/packages/Webkul/Payment/src/Payment/Payment.php index f390a814b..895b00114 100755 --- a/packages/Webkul/Payment/src/Payment/Payment.php +++ b/packages/Webkul/Payment/src/Payment/Payment.php @@ -129,7 +129,8 @@ abstract class Payment */ public function getAdditionalDetails() { - if (! $this->getConfigData('instructions') + if ( + ! $this->getConfigData('instructions') || $this->getConfigData('instructions') == '' ) { return []; diff --git a/packages/Webkul/Paypal/src/Helpers/Ipn.php b/packages/Webkul/Paypal/src/Helpers/Ipn.php index 6e49a7180..f51f0c0c1 100755 --- a/packages/Webkul/Paypal/src/Helpers/Ipn.php +++ b/packages/Webkul/Paypal/src/Helpers/Ipn.php @@ -52,7 +52,10 @@ class Ipn } try { - if (isset($this->post['txn_type']) && 'recurring_payment' == $this->post['txn_type']) { + if ( + isset($this->post['txn_type']) + && 'recurring_payment' == $this->post['txn_type'] + ) { } else { $this->getOrder(); diff --git a/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php b/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php index b9f33e301..b3006b38f 100755 --- a/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php +++ b/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php @@ -132,7 +132,10 @@ class SmartButtonController extends Controller ] ]; - if ($cart->haveStockableItems() && $cart->shipping_address) { + if ( + $cart->haveStockableItems() + && $cart->shipping_address + ) { $data['purchase_units'][0] = array_merge($data['purchase_units'][0], [ 'shipping' => [ 'address' => [ @@ -267,7 +270,10 @@ class SmartButtonController extends Controller throw new \Exception(trans('shop::app.checkout.cart.minimum-order-message', ['amount' => core()->currency($minimumOrderAmount)])); } - if ($cart->haveStockableItems() && ! $cart->shipping_address) { + if ( + $cart->haveStockableItems() + && ! $cart->shipping_address + ) { throw new \Exception(trans('Please check shipping address.')); } @@ -275,7 +281,10 @@ class SmartButtonController extends Controller throw new \Exception(trans('Please check billing address.')); } - if ($cart->haveStockableItems() && ! $cart->selected_shipping_rate) { + if ( + $cart->haveStockableItems() + && ! $cart->selected_shipping_rate + ) { throw new \Exception(trans('Please specify shipping method.')); } diff --git a/packages/Webkul/Paypal/src/Listeners/Transaction.php b/packages/Webkul/Paypal/src/Listeners/Transaction.php index 1d5013001..faf5353fa 100644 --- a/packages/Webkul/Paypal/src/Listeners/Transaction.php +++ b/packages/Webkul/Paypal/src/Listeners/Transaction.php @@ -31,7 +31,10 @@ class Transaction $data = request()->all(); if ($invoice->order->payment->method == 'paypal_smart_button') { - if (isset($data['orderData']) && isset($data['orderData']['orderID'])) { + if ( + isset($data['orderData']) + && isset($data['orderData']['orderID']) + ) { $smartButtonOrderId = $data['orderData']['orderID']; $transactionDetails = $this->smartButton->getOrder($smartButtonOrderId); $transactionDetails = json_decode(json_encode($transactionDetails), true); diff --git a/packages/Webkul/Product/src/Helpers/BundleOption.php b/packages/Webkul/Product/src/Helpers/BundleOption.php index 2df73e9e0..97fb9397a 100644 --- a/packages/Webkul/Product/src/Helpers/BundleOption.php +++ b/packages/Webkul/Product/src/Helpers/BundleOption.php @@ -41,7 +41,10 @@ class BundleOption extends AbstractProduct foreach ($this->product->bundle_options as $option) { $data = $this->getOptionItemData($option); - if (! $option->is_required && ! count($data['products'])) { + if ( + ! $option->is_required + && ! count($data['products']) + ) { continue; } diff --git a/packages/Webkul/Product/src/Helpers/ConfigurableOption.php b/packages/Webkul/Product/src/Helpers/ConfigurableOption.php index 9a00f30ee..9effc76e6 100755 --- a/packages/Webkul/Product/src/Helpers/ConfigurableOption.php +++ b/packages/Webkul/Product/src/Helpers/ConfigurableOption.php @@ -94,7 +94,10 @@ class ConfigurableOption extends AbstractProduct $attributeValue = $product->{$productAttribute->code}; - if ($attributeValue == '' && $product instanceof \Webkul\Product\Models\ProductFlat) { + if ( + $attributeValue == '' + && $product instanceof \Webkul\Product\Models\ProductFlat + ) { $attributeValue = $product->product->{$productAttribute->code}; } diff --git a/packages/Webkul/Product/src/Helpers/GenerateProduct.php b/packages/Webkul/Product/src/Helpers/GenerateProduct.php index ff42fee8f..9f10cbc8d 100644 --- a/packages/Webkul/Product/src/Helpers/GenerateProduct.php +++ b/packages/Webkul/Product/src/Helpers/GenerateProduct.php @@ -98,7 +98,8 @@ class GenerateProduct foreach ($attributes as $attribute) { if ($attribute->type == 'text') { - if ($attribute->code == 'width' + if ( + $attribute->code == 'width' || $attribute->code == 'height' || $attribute->code == 'depth' || $attribute->code == 'weight' @@ -114,7 +115,10 @@ class GenerateProduct } elseif ($attribute->type == 'textarea') { $data[$attribute->code] = $faker->text; - if ($attribute->code == 'description' || $attribute->code == 'short_description') { + if ( + $attribute->code == 'description' + || $attribute->code == 'short_description' + ) { $data[$attribute->code] = '

' . $data[$attribute->code] . '

'; } } elseif ($attribute->type == 'boolean') { @@ -131,7 +135,13 @@ class GenerateProduct } else { $data[$attribute->code] = $date->toDateString(); } - } elseif ($attribute->code != 'tax_category_id' && ($attribute->type == 'select' || $attribute->type == 'multiselect')) { + } elseif ( + $attribute->code != 'tax_category_id' + && ( + $attribute->type == 'select' + || $attribute->type == 'multiselect' + ) + ) { $options = $attribute->options; if ($attribute->type == 'select') { diff --git a/packages/Webkul/Product/src/Helpers/Toolbar.php b/packages/Webkul/Product/src/Helpers/Toolbar.php index 812ab5183..832dbfacd 100755 --- a/packages/Webkul/Product/src/Helpers/Toolbar.php +++ b/packages/Webkul/Product/src/Helpers/Toolbar.php @@ -89,7 +89,10 @@ class Toolbar extends AbstractProduct $params = request()->input(); $orderDirection = $params['order'] ?? 'asc'; - if (isset($params['sort']) && $key == $params['sort'] . '-' . $orderDirection) { + if ( + isset($params['sort']) + && $key == $params['sort'] . '-' . $orderDirection + ) { return true; } elseif (! isset($params['sort'])) { $sortBy = core()->getConfigData('catalog.products.storefront.sort_by') @@ -135,9 +138,15 @@ class Toolbar extends AbstractProduct ? core()->getConfigData('catalog.products.storefront.mode') : 'grid'; - if (request()->input() == null && $key == $defaultMode) { + if ( + request()->input() == null + && $key == $defaultMode + ) { return true; - } elseif (isset($params['mode']) && $key == $params['mode']) { + } elseif ( + isset($params['mode']) + && $key == $params['mode'] + ) { return true; } diff --git a/packages/Webkul/Product/src/Helpers/View.php b/packages/Webkul/Product/src/Helpers/View.php index 0428546bd..739ba4d2e 100755 --- a/packages/Webkul/Product/src/Helpers/View.php +++ b/packages/Webkul/Product/src/Helpers/View.php @@ -38,7 +38,10 @@ class View extends AbstractProduct continue; } } - } elseif ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') { + } elseif ( + $attribute->type == 'multiselect' + || $attribute->type == 'checkbox' + ) { $lables = []; $attributeOptions = $attributeOptionReposotory->findWhereIn('id', explode(",", $value)); diff --git a/packages/Webkul/Product/src/Http/Controllers/ProductController.php b/packages/Webkul/Product/src/Http/Controllers/ProductController.php index 25da17866..69ef046e3 100755 --- a/packages/Webkul/Product/src/Http/Controllers/ProductController.php +++ b/packages/Webkul/Product/src/Http/Controllers/ProductController.php @@ -221,7 +221,10 @@ class ProductController extends Controller $copiedProduct = $this->productRepository->copy($originalProduct); - if ($copiedProduct instanceof Product && $copiedProduct->id) { + if ( + $copiedProduct instanceof Product + && $copiedProduct->id + ) { session()->flash('success', trans('admin::app.response.product-copied')); } else { session()->flash('error', trans('admin::app.response.error-while-copying')); diff --git a/packages/Webkul/Product/src/Http/Requests/ProductForm.php b/packages/Webkul/Product/src/Http/Requests/ProductForm.php index d27288942..037b76375 100755 --- a/packages/Webkul/Product/src/Http/Requests/ProductForm.php +++ b/packages/Webkul/Product/src/Http/Requests/ProductForm.php @@ -67,7 +67,10 @@ class ProductForm extends FormRequest ]); foreach ($product->getEditableAttributes() as $attribute) { - if (in_array($attribute->code, ['sku', 'url_key']) || $attribute->type == 'boolean') { + if ( + in_array($attribute->code, ['sku', 'url_key']) + || $attribute->type == 'boolean' + ) { continue; } @@ -79,7 +82,10 @@ class ProductForm extends FormRequest $validations = $this->rules[$attribute->code]; } - if ($attribute->type == 'text' && $attribute->validation) { + if ( + $attribute->type == 'text' + && $attribute->validation + ) { array_push($validations, $attribute->validation == 'decimal' ? new Decimal diff --git a/packages/Webkul/Product/src/Listeners/ProductFlat.php b/packages/Webkul/Product/src/Listeners/ProductFlat.php index 61a63054c..d16ed9b11 100644 --- a/packages/Webkul/Product/src/Listeners/ProductFlat.php +++ b/packages/Webkul/Product/src/Listeners/ProductFlat.php @@ -90,7 +90,10 @@ class ProductFlat Schema::table('product_flat', function (Blueprint $table) use($attribute) { $table->{$this->attributeTypeFields[$attribute->type]}($attribute->code)->nullable(); - if ($attribute->type == 'select' || $attribute->type == 'multiselect') { + if ( + $attribute->type == 'select' + || $attribute->type == 'multiselect' + ) { $table->string($attribute->code . '_label')->nullable(); } }); @@ -111,7 +114,10 @@ class ProductFlat Schema::table('product_flat', function (Blueprint $table) use($attribute) { $table->dropColumn($attribute->code); - if ($attribute->type == 'select' || $attribute->type == 'multiselect') { + if ( + $attribute->type == 'select' + || $attribute->type == 'multiselect' + ) { $table->dropColumn($attribute->code . '_label'); } }); @@ -155,7 +161,10 @@ class ProductFlat $familyAttributes[$product->attribute_family_id] = $product->attribute_family->custom_attributes; } - if ($parentProduct && ! array_key_exists($parentProduct->id, $superAttributes)) { + if ( + $parentProduct + && ! array_key_exists($parentProduct->id, $superAttributes) + ) { $superAttributes[$parentProduct->id] = $parentProduct->super_attributes()->pluck('code')->toArray(); } diff --git a/packages/Webkul/Product/src/Models/ProductFlat.php b/packages/Webkul/Product/src/Models/ProductFlat.php index 38c88b797..d58e00371 100644 --- a/packages/Webkul/Product/src/Models/ProductFlat.php +++ b/packages/Webkul/Product/src/Models/ProductFlat.php @@ -75,7 +75,13 @@ class ProductFlat extends Model implements ProductFlatContract ->getSingletonInstance(AttributeRepository::class) ->getAttributeByCode($key); - if ($attribute && ($attribute->value_per_channel || $attribute->value_per_locale)) { + if ( + $attribute + && ( + $attribute->value_per_channel + || $attribute->value_per_locale + ) + ) { $defaultProduct = $this->getDefaultProduct(); $this->attributes[$key] = $defaultProduct->attributes[$key]; diff --git a/packages/Webkul/Product/src/ProductImage.php b/packages/Webkul/Product/src/ProductImage.php index b49fa3b89..3f2218fb2 100644 --- a/packages/Webkul/Product/src/ProductImage.php +++ b/packages/Webkul/Product/src/ProductImage.php @@ -46,7 +46,11 @@ class ProductImage extends AbstractProduct $images[] = $this->getCachedImageUrls($image->path); } - if (! $product->parent_id && ! count($images) && ! count($product->videos)) { + if ( + ! $product->parent_id + && ! count($images) + && ! count($product->videos) + ) { $images[] = $this->getFallbackImageUrls(); } diff --git a/packages/Webkul/Product/src/Repositories/ProductBundleOptionProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductBundleOptionProductRepository.php index 80ce9ce6e..403107cce 100644 --- a/packages/Webkul/Product/src/Repositories/ProductBundleOptionProductRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductBundleOptionProductRepository.php @@ -62,14 +62,20 @@ class ProductBundleOptionProductRepository extends Repository $haveIsDefaulFlag = false; foreach ($data['products'] as $key => $product) { - if (isset($product['is_default']) && $product['is_default']) { + if ( + isset($product['is_default']) + && $product['is_default'] + ) { $haveIsDefaulFlag = true; } else { $data['products'][$key]['is_default'] = 0; } } - if (! $haveIsDefaulFlag && $data['is_required']) { + if ( + ! $haveIsDefaulFlag + && $data['is_required'] + ) { $data['products'][key($data['products'])]['is_default'] = 1; } } diff --git a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php index 41de96fee..e994f3d40 100644 --- a/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductFlatRepository.php @@ -98,9 +98,15 @@ class ProductFlatRepository extends Repository foreach ($attributeKeys as $key) { if (! is_null($attribute[$key])) { - if ($key == 'integer_value' && ! in_array($attribute[$key], $attributeInfo['attributeOptions'])) { + if ( + $key == 'integer_value' + && ! in_array($attribute[$key], $attributeInfo['attributeOptions']) + ) { array_push($attributeInfo['attributeOptions'], $attribute[$key]); - } elseif ($key == 'text_value' && ! in_array($attribute[$key], $attributeInfo['attributeOptions'])) { + } elseif ( + $key == 'text_value' + && ! in_array($attribute[$key], $attributeInfo['attributeOptions']) + ) { $multiSelectArrributes = explode(",", $attribute[$key]); foreach ($multiSelectArrributes as $multi) { @@ -108,7 +114,13 @@ class ProductFlatRepository extends Repository array_push($attributeInfo['attributeOptions'], $multi); } } - } elseif (($key == 'attribute_id' || $key == 'attributeId') && ! in_array($attribute[$key], $attributeInfo['attributes'])) { + } elseif ( + ( + $key == 'attribute_id' + || $key == 'attributeId' + ) + && ! in_array($attribute[$key], $attributeInfo['attributes']) + ) { array_push($attributeInfo['attributes'], $attribute[$key]); } } diff --git a/packages/Webkul/Product/src/Repositories/ProductMediaRepository.php b/packages/Webkul/Product/src/Repositories/ProductMediaRepository.php index 189b799dd..28fe1c7b1 100644 --- a/packages/Webkul/Product/src/Repositories/ProductMediaRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductMediaRepository.php @@ -50,7 +50,10 @@ class ProductMediaRepository extends Repository */ $previousIds = $this->resolveFileTypeQueryBuilder($product, $uploadFileType)->pluck('id'); - if (isset($data[$uploadFileType]['files']) && $data[$uploadFileType]['files']) { + if ( + isset($data[$uploadFileType]['files']) + && $data[$uploadFileType]['files'] + ) { foreach ($data[$uploadFileType]['files'] as $indexOrModelId => $file) { if ($file instanceof UploadedFile) { $this->create([ @@ -63,7 +66,10 @@ class ProductMediaRepository extends Repository /** * Filter out existing models because new model positions are already setuped by index. */ - if (isset($data[$uploadFileType]['positions']) && $data[$uploadFileType]['positions']) { + if ( + isset($data[$uploadFileType]['positions']) + && $data[$uploadFileType]['positions'] + ) { $positions = collect($data[$uploadFileType]['positions'])->keys()->filter(function ($position) { return is_numeric($position); }); diff --git a/packages/Webkul/Product/src/Repositories/ProductRepository.php b/packages/Webkul/Product/src/Repositories/ProductRepository.php index 7cb22e671..4cbfa3fd3 100755 --- a/packages/Webkul/Product/src/Repositories/ProductRepository.php +++ b/packages/Webkul/Product/src/Repositories/ProductRepository.php @@ -223,7 +223,11 @@ class ProductRepository extends Repository # sort direction $orderDirection = 'asc'; - if (isset($params['order']) && in_array($params['order'], ['desc', 'asc'])) { + + if ( + isset($params['order']) + && in_array($params['order'], ['desc', 'asc']) + ) { $orderDirection = $params['order']; } else { $sortOptions = $this->getDefaultSortByOption(); diff --git a/packages/Webkul/Product/src/Type/AbstractType.php b/packages/Webkul/Product/src/Type/AbstractType.php index fa7de9f64..ee37eb2d7 100644 --- a/packages/Webkul/Product/src/Type/AbstractType.php +++ b/packages/Webkul/Product/src/Type/AbstractType.php @@ -173,11 +173,17 @@ abstract class AbstractType foreach ($product->attribute_family->custom_attributes as $attribute) { $route = request()->route() ? request()->route()->getName() : ''; - if ($attribute->type === 'boolean' && $route !== 'admin.catalog.products.massupdate') { + if ( + $attribute->type === 'boolean' + && $route !== 'admin.catalog.products.massupdate' + ) { $data[$attribute->code] = isset($data[$attribute->code]) && $data[$attribute->code] ? 1 : 0; } - if ($attribute->type == 'multiselect' || $attribute->type == 'checkbox') { + if ( + $attribute->type == 'multiselect' + || $attribute->type == 'checkbox' + ) { $data[$attribute->code] = isset($data[$attribute->code]) ? implode(',', $data[$attribute->code]) : null; } @@ -185,15 +191,26 @@ abstract class AbstractType continue; } - if ($attribute->type === 'price' && isset($data[$attribute->code]) && $data[$attribute->code] === '') { + if ( + $attribute->type === 'price' + && isset($data[$attribute->code]) + && $data[$attribute->code] === '' + ) { $data[$attribute->code] = null; } - if ($attribute->type === 'date' && $data[$attribute->code] === '' && $route !== 'admin.catalog.products.massupdate') { + if ( + $attribute->type === 'date' + && $data[$attribute->code] === '' + && $route !== 'admin.catalog.products.massupdate' + ) { $data[$attribute->code] = null; } - if ($attribute->type === 'image' || $attribute->type === 'file') { + if ( + $attribute->type === 'image' + || $attribute->type === 'file' + ) { $data[$attribute->code] = gettype($data[$attribute->code]) === 'object' ? request()->file($attribute->code)->store('product/' . $product->id) : null; @@ -238,7 +255,10 @@ abstract class AbstractType } else { $productAttributeValue->update([$columnName => $data[$attribute->code]]); - if ($attribute->type == 'image' || $attribute->type == 'file') { + if ( + $attribute->type == 'image' + || $attribute->type == 'file' + ) { Storage::delete($attributeValue->text_value); } } @@ -579,7 +599,11 @@ abstract class AbstractType $specialPrice = $this->product->special_price; - if ((is_null($specialPrice) || ! (float) $specialPrice) + if ( + ( + is_null($specialPrice) + || ! (float) $specialPrice + ) && ! $rulePrice && $customerGroupPrice == $this->product->price ) { @@ -589,13 +613,19 @@ abstract class AbstractType $haveSpecialPrice = false; if (! (float) $specialPrice) { - if ($rulePrice && $rulePrice->price < $this->product->price) { + if ( + $rulePrice + && $rulePrice->price < $this->product->price + ) { $this->product->special_price = $rulePrice->price; $haveSpecialPrice = true; } } else { - if ($rulePrice && $rulePrice->price <= $this->product->special_price) { + if ( + $rulePrice + && $rulePrice->price <= $this->product->special_price + ) { $this->product->special_price = $rulePrice->price; $haveSpecialPrice = true; @@ -661,7 +691,10 @@ abstract class AbstractType $lastCustomerGroupId = null; foreach ($customerGroupPrices as $price) { - if ($price->customer_group_id != $customerGroupId && $price->customer_group_id) { + if ( + $price->customer_group_id != $customerGroupId + && $price->customer_group_id + ) { continue; } @@ -682,7 +715,10 @@ abstract class AbstractType } if ($price->value_type == 'discount') { - if ($price->value >= 0 && $price->value <= 100) { + if ( + $price->value >= 0 + && $price->value <= 100 + ) { $lastPrice = $product->price - ($product->price * $price->value) / 100; $lastQty = $price->qty; @@ -690,7 +726,10 @@ abstract class AbstractType $lastCustomerGroupId = $price->customer_group_id; } } else { - if ($price->value >= 0 && $price->value < $lastPrice) { + if ( + $price->value >= 0 + && $price->value < $lastPrice + ) { $lastPrice = $price->value; $lastQty = $price->qty; @@ -752,7 +791,10 @@ abstract class AbstractType $address = null; if ($taxCategory = $this->getTaxCategory()) { - if ($address === null && auth()->guard('customer')->check()) { + if ( + $address === null + && auth()->guard('customer')->check() + ) { $address = auth()->guard('customer')->user()->addresses->where('default_address', 1)->first(); } @@ -860,15 +902,24 @@ abstract class AbstractType if ($this->product->id != $options2['product_id']) { return false; } else { - if (isset($options1['parent_id']) && isset($options2['parent_id'])) { + if ( + isset($options1['parent_id']) + && isset($options2['parent_id']) + ) { if ($options1['parent_id'] == $options2['parent_id']) { return true; } else { return false; } - } elseif (isset($options1['parent_id']) && ! isset($options2['parent_id'])) { + } elseif ( + isset($options1['parent_id']) + && ! isset($options2['parent_id']) + ) { return false; - } elseif (isset($options2['parent_id']) && ! isset($options1['parent_id'])) { + } elseif ( + isset($options2['parent_id']) + && ! isset($options1['parent_id']) + ) { return false; } } @@ -974,7 +1025,10 @@ abstract class AbstractType break; case 'configurable': - if ($item->child && $item->child->product->status === 0) { + if ( + $item->child + && $item->child->product->status === 0 + ) { return true; } break; @@ -1012,13 +1066,19 @@ abstract class AbstractType if ($this->haveSpecialPrice()) { $rulePrice = app('Webkul\CatalogRule\Helpers\CatalogRuleProductPrice')->getRulePrice($this->product); - if ($rulePrice && $rulePrice->price < $this->product->special_price) { + if ( + $rulePrice + && $rulePrice->price < $this->product->special_price + ) { $haveOffers = false; } if ($haveOffers) { foreach ($customerGroupPrices as $key => $customerGroupPrice) { - if ($customerGroupPrice && $customerGroupPrice->qty > 1) { + if ( + $customerGroupPrice + && $customerGroupPrice->qty > 1 + ) { array_push($offerLines, $this->getOfferLines($customerGroupPrice)); } } diff --git a/packages/Webkul/Product/src/Type/Bundle.php b/packages/Webkul/Product/src/Type/Bundle.php index 3dac6fff9..326333433 100644 --- a/packages/Webkul/Product/src/Type/Bundle.php +++ b/packages/Webkul/Product/src/Type/Bundle.php @@ -196,7 +196,10 @@ class Bundle extends AbstractType } } - if (! $haveRequiredOptions && count($minPrices)) { + if ( + ! $haveRequiredOptions + && count($minPrices) + ) { $minPrice = min($minPrices); } @@ -437,7 +440,10 @@ class Bundle extends AbstractType $data['bundle_options'] = array_filter($this->validateBundleOptionForCart($data['bundle_options'])); } - if (! isset($data['bundle_options']) || ! count($data['bundle_options'])) { + if ( + ! isset($data['bundle_options']) + || ! count($data['bundle_options']) + ) { return trans('shop::app.checkout.cart.integrity.missing_options'); } @@ -537,11 +543,17 @@ class Bundle extends AbstractType */ public function compareOptions($options1, $options2) { - if (isset($options2['product_id']) && $this->product->id != $options2['product_id']) { + if ( + isset($options2['product_id']) + && $this->product->id != $options2['product_id'] + ) { return false; } - if (isset($options1['bundle_options']) && isset($options2['bundle_options'])) { + if ( + isset($options1['bundle_options']) + && isset($options2['bundle_options']) + ) { return $options1['bundle_options'] == $options2['bundle_options'] && $options1['bundle_option_qty'] == $this->getOptionQuantities($options2); } diff --git a/packages/Webkul/Product/src/Type/Configurable.php b/packages/Webkul/Product/src/Type/Configurable.php index ba6b56b88..dfe774318 100644 --- a/packages/Webkul/Product/src/Type/Configurable.php +++ b/packages/Webkul/Product/src/Type/Configurable.php @@ -220,7 +220,10 @@ class Configurable extends AbstractType $typeOfVariants = 'simple'; $productInstance = app(config('product_types.' . $product->type . '.class')); - if (isset($productInstance->variantsType) && ! in_array($productInstance->variantsType, ['bundle', 'configurable', 'grouped'])) { + if ( + isset($productInstance->variantsType) + && ! in_array($productInstance->variantsType, ['bundle', 'configurable', 'grouped']) + ) { $typeOfVariants = $productInstance->variantsType; } @@ -556,7 +559,10 @@ class Configurable extends AbstractType $customerGroupPrices[] = $this->getCustomerGroupPrice($variant, 1); } - if ($rulePrices || $customerGroupPrices) { + if ( + $rulePrices + || $customerGroupPrices + ) { return $offerPrice = min(array_merge($rulePrices, $customerGroupPrices)); } @@ -649,7 +655,10 @@ class Configurable extends AbstractType */ public function prepareForCart($data) { - if (! isset($data['selected_configurable_option']) || ! $data['selected_configurable_option']) { + if ( + ! isset($data['selected_configurable_option']) + || ! $data['selected_configurable_option'] + ) { if ($this->getDefaultVariantId()) { $data['selected_configurable_option'] = $this->getDefaultVariantId(); } else { @@ -709,7 +718,10 @@ class Configurable extends AbstractType return false; } - if (isset($options1['selected_configurable_option']) && isset($options2['selected_configurable_option'])) { + if ( + isset($options1['selected_configurable_option']) + && isset($options2['selected_configurable_option']) + ) { return $options1['selected_configurable_option'] === $options2['selected_configurable_option']; } diff --git a/packages/Webkul/Product/src/Type/Downloadable.php b/packages/Webkul/Product/src/Type/Downloadable.php index a794f5e55..22bb96131 100644 --- a/packages/Webkul/Product/src/Type/Downloadable.php +++ b/packages/Webkul/Product/src/Type/Downloadable.php @@ -161,7 +161,10 @@ class Downloadable extends AbstractType */ public function prepareForCart($data) { - if (! isset($data['links']) || ! count($data['links'])) { + if ( + ! isset($data['links']) + || ! count($data['links']) + ) { return trans('shop::app.checkout.cart.integrity.missing_links'); } @@ -194,7 +197,10 @@ class Downloadable extends AbstractType return false; } - if (isset($options1['links']) && isset($options2['links'])) { + if ( + isset($options1['links']) + && isset($options2['links']) + ) { return $options1['links'] === $options2['links']; } diff --git a/packages/Webkul/Product/src/Type/Grouped.php b/packages/Webkul/Product/src/Type/Grouped.php index 51ecd0f53..b0ff7f034 100644 --- a/packages/Webkul/Product/src/Type/Grouped.php +++ b/packages/Webkul/Product/src/Type/Grouped.php @@ -202,7 +202,10 @@ class Grouped extends AbstractType */ public function prepareForCart($data) { - if (! isset($data['qty']) || ! is_array($data['qty'])) { + if ( + ! isset($data['qty']) + || ! is_array($data['qty']) + ) { return trans('shop::app.checkout.cart.integrity.missing_options'); } diff --git a/packages/Webkul/Product/src/Type/Simple.php b/packages/Webkul/Product/src/Type/Simple.php index 679640bae..a776334e2 100644 --- a/packages/Webkul/Product/src/Type/Simple.php +++ b/packages/Webkul/Product/src/Type/Simple.php @@ -38,8 +38,10 @@ class Simple extends AbstractType return false; } - if (is_callable(config('products.isSaleable')) && - call_user_func(config('products.isSaleable'), $product) === false) { + if ( + is_callable(config('products.isSaleable')) && + call_user_func(config('products.isSaleable'), $product) === false + ) { return false; } diff --git a/packages/Webkul/Product/src/Type/Virtual.php b/packages/Webkul/Product/src/Type/Virtual.php index 0a2ffd644..4f7753452 100644 --- a/packages/Webkul/Product/src/Type/Virtual.php +++ b/packages/Webkul/Product/src/Type/Virtual.php @@ -50,8 +50,10 @@ class Virtual extends AbstractType return false; } - if (is_callable(config('products.isSaleable')) && - call_user_func(config('products.isSaleable'), $this->product) === false) { + if ( + is_callable(config('products.isSaleable')) && + call_user_func(config('products.isSaleable'), $this->product) === false + ) { return false; } diff --git a/packages/Webkul/Rule/src/Helpers/Validator.php b/packages/Webkul/Rule/src/Helpers/Validator.php index e171da76c..e2a82945e 100644 --- a/packages/Webkul/Rule/src/Helpers/Validator.php +++ b/packages/Webkul/Rule/src/Helpers/Validator.php @@ -22,11 +22,19 @@ class Validator $validConditionCount = $totalConditionCount = 0; foreach ($rule->conditions as $condition) { - if (! $condition['attribute'] || ! isset($condition['value']) || is_null($condition['value']) || $condition['value'] == '') { + if ( + ! $condition['attribute'] + || ! isset($condition['value']) + || is_null($condition['value']) + || $condition['value'] == '' + ) { continue; } - if ($entity instanceof \Webkul\Checkout\Contracts\Cart && strpos($condition['attribute'], 'cart|') === false) { + if ( + $entity instanceof \Webkul\Checkout\Contracts\Cart + && strpos($condition['attribute'], 'cart|') === false + ) { continue; } @@ -220,7 +228,10 @@ class Validator break; case '{}': case '!{}': - if (is_scalar($attributeValue) && is_array($condition['value'])) { + if ( + is_scalar($attributeValue) + && is_array($condition['value']) + ) { foreach ($condition['value'] as $item) { if (stripos($attributeValue, $item) !== false) { $result = true; diff --git a/packages/Webkul/Sales/src/Database/Factories/OrderItemFactory.php b/packages/Webkul/Sales/src/Database/Factories/OrderItemFactory.php index 1920eb584..bb5ec3d14 100644 --- a/packages/Webkul/Sales/src/Database/Factories/OrderItemFactory.php +++ b/packages/Webkul/Sales/src/Database/Factories/OrderItemFactory.php @@ -27,12 +27,12 @@ class OrderItemFactory extends Factory if (isset($attributes['product_id'])) { $product = Product::query() - ->where('id', $attributes['product_id']) - ->first(); + ->where('id', $attributes['product_id']) + ->first(); } else { $product = Product::factory() - ->simple() - ->create(); + ->simple() + ->create(); } $fallbackPrice = $this->faker->randomFloat(4, 0, 1000); diff --git a/packages/Webkul/Sales/src/Generators/Sequencer.php b/packages/Webkul/Sales/src/Generators/Sequencer.php index 816e9a6ce..4168b72db 100644 --- a/packages/Webkul/Sales/src/Generators/Sequencer.php +++ b/packages/Webkul/Sales/src/Generators/Sequencer.php @@ -110,7 +110,12 @@ class Sequencer implements SequencerContract */ public function generate(): string { - if ($this->length && ($this->prefix || $this->suffix)) { + if ( + $this->length + && ( + $this->prefix || $this->suffix + ) + ) { $number = ($this->prefix) . sprintf( "%0{$this->length}d", ($this->lastId + 1) diff --git a/packages/Webkul/Sales/src/Models/Order.php b/packages/Webkul/Sales/src/Models/Order.php index c9409b838..d089ae84d 100755 --- a/packages/Webkul/Sales/src/Models/Order.php +++ b/packages/Webkul/Sales/src/Models/Order.php @@ -255,7 +255,10 @@ class Order extends Model implements OrderContract } foreach ($this->items as $item) { - if ($item->canShip() && $item->order->status !== self::STATUS_CLOSED) { + if ( + $item->canShip() + && $item->order->status !== self::STATUS_CLOSED + ) { return true; } } @@ -275,7 +278,10 @@ class Order extends Model implements OrderContract } foreach ($this->items as $item) { - if ($item->canInvoice() && $item->order->status !== self::STATUS_CLOSED) { + if ( + $item->canInvoice() + && $item->order->status !== self::STATUS_CLOSED + ) { return true; } } @@ -308,11 +314,17 @@ class Order extends Model implements OrderContract */ public function canCancel(): bool { - if ($this->payment->method == 'cashondelivery' && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice')) { + if ( + $this->payment->method == 'cashondelivery' + && core()->getConfigData('sales.paymentmethods.cashondelivery.generate_invoice') + ) { return false; } - if ($this->payment->method == 'moneytransfer' && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice')) { + if ( + $this->payment->method == 'moneytransfer' + && core()->getConfigData('sales.paymentmethods.moneytransfer.generate_invoice') + ) { return false; } @@ -322,12 +334,16 @@ class Order extends Model implements OrderContract $pendingInvoice = $this->invoices->where('state', 'pending') ->first(); + if ($pendingInvoice) { return true; } foreach ($this->items as $item) { - if ($item->canCancel() && $item->order->status !== self::STATUS_CLOSED) { + if ( + $item->canCancel() + && $item->order->status !== self::STATUS_CLOSED + ) { return true; } } @@ -348,12 +364,16 @@ class Order extends Model implements OrderContract $pendingInvoice = $this->invoices->where('state', 'pending') ->first(); + if ($pendingInvoice) { return false; } foreach ($this->items as $item) { - if ($item->qty_to_refund > 0 && $item->order->status !== self::STATUS_CLOSED) { + if ( + $item->qty_to_refund > 0 + && $item->order->status !== self::STATUS_CLOSED + ) { return true; } } diff --git a/packages/Webkul/Sales/src/Models/OrderItem.php b/packages/Webkul/Sales/src/Models/OrderItem.php index f938e0a95..2ad988915 100755 --- a/packages/Webkul/Sales/src/Models/OrderItem.php +++ b/packages/Webkul/Sales/src/Models/OrderItem.php @@ -65,7 +65,7 @@ class OrderItem extends Model implements OrderItemContract */ public function canShip(): bool { - if (!$this->isStockable()) { + if (! $this->isStockable()) { return false; } @@ -81,7 +81,7 @@ class OrderItem extends Model implements OrderItemContract */ public function getQtyToShipAttribute() { - if (!$this->isStockable()) { + if (! $this->isStockable()) { return 0; } diff --git a/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php b/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php index 1a9347a23..d01d452b0 100644 --- a/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php +++ b/packages/Webkul/Sales/src/Repositories/DownloadableLinkPurchasedRepository.php @@ -71,7 +71,10 @@ class DownloadableLinkPurchasedRepository extends Repository * @return bool */ private function isValidDownloadableProduct($orderItem) : bool { - if (stristr($orderItem->type,'downloadable') !== false && isset($orderItem->additional['links'])) { + if ( + stristr($orderItem->type,'downloadable') !== false + && isset($orderItem->additional['links']) + ) { return true; } diff --git a/packages/Webkul/Sales/src/Repositories/InvoiceItemRepository.php b/packages/Webkul/Sales/src/Repositories/InvoiceItemRepository.php index e2ee6be07..749af476c 100755 --- a/packages/Webkul/Sales/src/Repositories/InvoiceItemRepository.php +++ b/packages/Webkul/Sales/src/Repositories/InvoiceItemRepository.php @@ -30,8 +30,8 @@ class InvoiceItemRepository extends Repository } $orderedInventory = $data['product']->ordered_inventories() - ->where('channel_id', $data['invoice']->order->channel->id) - ->first(); + ->where('channel_id', $data['invoice']->order->channel->id) + ->first(); if ($orderedInventory) { if (($orderedQty = $orderedInventory->qty - $data['qty']) < 0) { @@ -42,10 +42,10 @@ class InvoiceItemRepository extends Repository } $inventories = $data['product']->inventories() - ->where('vendor_id', $data['vendor_id']) - ->whereIn('inventory_source_id', $data['invoice']->order->channel->inventory_sources()->pluck('id')) - ->orderBy('qty', 'desc') - ->get(); + ->where('vendor_id', $data['vendor_id']) + ->whereIn('inventory_source_id', $data['invoice']->order->channel->inventory_sources()->pluck('id')) + ->orderBy('qty', 'desc') + ->get(); foreach ($inventories as $key => $inventory) { if ($inventory->qty >= $data['qty']) { diff --git a/packages/Webkul/Sales/src/Repositories/OrderItemRepository.php b/packages/Webkul/Sales/src/Repositories/OrderItemRepository.php index bc2574558..01176fab2 100755 --- a/packages/Webkul/Sales/src/Repositories/OrderItemRepository.php +++ b/packages/Webkul/Sales/src/Repositories/OrderItemRepository.php @@ -26,7 +26,10 @@ class OrderItemRepository extends Repository */ public function create(array $data) { - if (isset($data['product']) && $data['product']) { + if ( + isset($data['product']) + && $data['product'] + ) { $data['product_id'] = $data['product']->id; $data['product_type'] = get_class($data['product']); diff --git a/packages/Webkul/Sales/src/Repositories/OrderRepository.php b/packages/Webkul/Sales/src/Repositories/OrderRepository.php index 30a8012e5..df39092d7 100755 --- a/packages/Webkul/Sales/src/Repositories/OrderRepository.php +++ b/packages/Webkul/Sales/src/Repositories/OrderRepository.php @@ -52,14 +52,20 @@ class OrderRepository extends Repository try { Event::dispatch('checkout.order.save.before', [$data]); - if (isset($data['customer']) && $data['customer']) { + if ( + isset($data['customer']) + && $data['customer'] + ) { $data['customer_id'] = $data['customer']->id; $data['customer_type'] = get_class($data['customer']); } else { unset($data['customer']); } - if (isset($data['channel']) && $data['channel']) { + if ( + isset($data['channel']) + && $data['channel'] + ) { $data['channel_id'] = $data['channel']->id; $data['channel_type'] = get_class($data['channel']); $data['channel_name'] = $data['channel']->name; @@ -88,7 +94,10 @@ class OrderRepository extends Repository $orderItem = $this->orderItemRepository->create(array_merge($item, ['order_id' => $order->id])); - if (isset($item['children']) && $item['children']) { + if ( + isset($item['children']) + && $item['children'] + ) { foreach ($item['children'] as $child) { $this->orderItemRepository->create(array_merge($child, ['order_id' => $order->id, 'parent_id' => $orderItem->id])); } @@ -175,7 +184,10 @@ class OrderRepository extends Repository $orderItem->qty_canceled += $orderItem->qty_to_cancel; $orderItem->save(); - if ($orderItem->parent && $orderItem->parent->qty_ordered) { + if ( + $orderItem->parent + && $orderItem->parent->qty_ordered + ) { $orderItem->parent->qty_canceled += $orderItem->parent->qty_to_cancel; $orderItem->parent->save(); } @@ -241,7 +253,10 @@ class OrderRepository extends Repository * If order is already completed and total quantity ordered is not equal to refunded * then it can be considered as completed. */ - if ($order->status === OrderModel::STATUS_COMPLETED && $totalQtyOrdered != $totalQtyRefunded) { + if ( + $order->status === OrderModel::STATUS_COMPLETED + && $totalQtyOrdered != $totalQtyRefunded + ) { return true; } diff --git a/packages/Webkul/Sales/src/Repositories/RefundItemRepository.php b/packages/Webkul/Sales/src/Repositories/RefundItemRepository.php index 44def98dc..487f96f9b 100644 --- a/packages/Webkul/Sales/src/Repositories/RefundItemRepository.php +++ b/packages/Webkul/Sales/src/Repositories/RefundItemRepository.php @@ -31,7 +31,10 @@ class RefundItemRepository extends Repository return; } - if ($orderItem->qty_shipped && $quantity > $orderItem->qty_ordered - $orderItem->qty_shipped) { + if ( + $orderItem->qty_shipped + && $quantity > $orderItem->qty_ordered - $orderItem->qty_shipped + ) { $nonShippedQty = $orderItem->qty_ordered - $orderItem->qty_shipped; if (($totalShippedQtyToRefund = $quantity - $nonShippedQty) > 0) { @@ -69,8 +72,9 @@ class RefundItemRepository extends Repository $quantity -= $totalShippedQtyToRefund; } - } elseif (! $orderItem->getTypeInstance()->isStockable() - && $orderItem->getTypeInstance()->showQuantityBox() + } elseif ( + ! $orderItem->getTypeInstance()->isStockable() + && $orderItem->getTypeInstance()->showQuantityBox() ) { $inventory = $orderItem->product->inventories() // ->where('vendor_id', $data['vendor_id']) diff --git a/packages/Webkul/Sales/src/Repositories/RefundRepository.php b/packages/Webkul/Sales/src/Repositories/RefundRepository.php index b6fe27bcf..d5b21d307 100644 --- a/packages/Webkul/Sales/src/Repositories/RefundRepository.php +++ b/packages/Webkul/Sales/src/Repositories/RefundRepository.php @@ -128,7 +128,10 @@ class RefundRepository extends Repository 'additional' => $childOrderItem->additional, ]); - if ($childOrderItem->getTypeInstance()->isStockable() || $childOrderItem->getTypeInstance()->showQuantityBox()) { + if ( + $childOrderItem->getTypeInstance()->isStockable() + || $childOrderItem->getTypeInstance()->showQuantityBox() + ) { $this->refundItemRepository->returnQtyToProductInventory($childOrderItem, $finalQty); } @@ -136,7 +139,10 @@ class RefundRepository extends Repository } } else { - if ($orderItem->getTypeInstance()->isStockable() || $orderItem->getTypeInstance()->showQuantityBox()) { + if ( + $orderItem->getTypeInstance()->isStockable() + || $orderItem->getTypeInstance()->showQuantityBox() + ) { $this->refundItemRepository->returnQtyToProductInventory($orderItem, $qty); } } diff --git a/packages/Webkul/Shipping/src/Shipping.php b/packages/Webkul/Shipping/src/Shipping.php index 1d3842252..74d4058db 100755 --- a/packages/Webkul/Shipping/src/Shipping.php +++ b/packages/Webkul/Shipping/src/Shipping.php @@ -149,7 +149,10 @@ class Shipping { $shippingMethods = $this->collectRates()['shippingMethods'] ?? []; - if (empty($shippingMethods) || ! $shippingMethods) { + if ( + empty($shippingMethods) + || ! $shippingMethods + ) { return false; } diff --git a/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php b/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php index f669025e9..76b78f7f4 100644 --- a/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php +++ b/packages/Webkul/Shop/src/DataGrids/DownloadableProductDataGrid.php @@ -67,7 +67,11 @@ class DownloadableProductDataGrid extends DataGrid 'sortable' => true, 'filterable' => true, 'closure' => function ($value) { - if ($value->status == 'pending' || $value->status == 'expired' || $value->invoice_state !== 'paid') { + if ( + $value->status == 'pending' + || $value->status == 'expired' + || $value->invoice_state !== 'paid' + ) { return $value->product_name; } else { return $value->product_name . ' ' . '' . $value->name . ''; @@ -110,7 +114,7 @@ class DownloadableProductDataGrid extends DataGrid 'sortable' => true, 'filterable' => false, 'closure' => function ($value) { - if (!$value->download_bought) { + if (! $value->download_bought) { return trans('shop::app.customer.account.downloadable_products.unlimited'); } diff --git a/packages/Webkul/Shop/src/Http/Controllers/CartController.php b/packages/Webkul/Shop/src/Http/Controllers/CartController.php index 6df29440e..395ca70f7 100755 --- a/packages/Webkul/Shop/src/Http/Controllers/CartController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/CartController.php @@ -225,13 +225,21 @@ class CartController extends Controller */ private function onFailureAddingToCart($result): bool { - if (is_array($result) && isset($result['warning'])) { + if ( + is_array($result) + && isset($result['warning']) + ) { session()->flash('warning', $result['warning']); + return true; } - if (is_array($result) && isset($result['info'])) { + if ( + is_array($result) + && isset($result['info']) + ) { session()->flash('info', $result['info']); + return true; } diff --git a/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php b/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php index 14fdf4b4a..ea1ab348e 100644 --- a/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php @@ -60,14 +60,19 @@ class DownloadableProductController extends Controller $orderedQty = $downloadableLinkPurchased->order->total_qty_ordered; $totalInvoiceQty = $totalInvoiceQty * ($downloadableLinkPurchased->download_bought / $orderedQty); - if ($downloadableLinkPurchased->download_used == $totalInvoiceQty || $downloadableLinkPurchased->download_used > $totalInvoiceQty) { + if ( + $downloadableLinkPurchased->download_used == $totalInvoiceQty + || $downloadableLinkPurchased->download_used > $totalInvoiceQty + ) { session()->flash('warning', trans('shop::app.customer.account.downloadable_products.payment-error')); return redirect()->route('customer.downloadable_products.index'); } - if ($downloadableLinkPurchased->download_bought - && ($downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + $downloadableLinkPurchased->download_canceled)) <= 0) { + if ( + $downloadableLinkPurchased->download_bought + && ($downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + $downloadableLinkPurchased->download_canceled)) <= 0 + ) { session()->flash('warning', trans('shop::app.customer.account.downloadable_products.download-error')); diff --git a/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php b/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php index dec31e592..c472c3dbb 100755 --- a/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/OnepageController.php @@ -37,11 +37,17 @@ class OnepageController extends Controller { Event::dispatch('checkout.load.index'); - if (! auth()->guard('customer')->check() && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout')) { + if ( + ! auth()->guard('customer')->check() + && ! core()->getConfigData('catalog.products.guest-checkout.allow-guest-checkout') + ) { return redirect()->route('customer.session.index'); } - if (auth()->guard('customer')->check() && auth()->guard('customer')->user()->is_suspended) { + if ( + auth()->guard('customer')->check() + && auth()->guard('customer')->user()->is_suspended + ) { session()->flash('warning', trans('shop::app.checkout.cart.suspended-account-message')); return redirect()->route('shop.checkout.cart.index'); @@ -54,8 +60,14 @@ class OnepageController extends Controller $cart = Cart::getCart(); if ( - (! auth()->guard('customer')->check() && $cart->hasDownloadableItems()) - || (! auth()->guard('customer')->check() && ! $cart->hasGuestCheckoutItems()) + ( + ! auth()->guard('customer')->check() + && $cart->hasDownloadableItems() + ) + || ( + ! auth()->guard('customer')->check() + && ! $cart->hasGuestCheckoutItems() + ) ) { return redirect()->route('customer.session.index'); } @@ -97,14 +109,20 @@ class OnepageController extends Controller { $data = $request->all(); - if (! auth()->guard('customer')->check() && ! Cart::getCart()->hasGuestCheckoutItems()) { + if ( + ! auth()->guard('customer')->check() + && ! Cart::getCart()->hasGuestCheckoutItems() + ) { return response()->json(['redirect_url' => route('customer.session.index')], 403); } $data['billing']['address1'] = implode(PHP_EOL, array_filter($data['billing']['address1'])); $data['shipping']['address1'] = implode(PHP_EOL, array_filter($data['shipping']['address1'])); - if (Cart::hasError() || ! Cart::saveCustomerAddress($data)) { + if ( + Cart::hasError() + || ! Cart::saveCustomerAddress($data) + ) { return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403); } @@ -132,7 +150,11 @@ class OnepageController extends Controller { $shippingMethod = request()->get('shipping_method'); - if (Cart::hasError() || ! $shippingMethod || ! Cart::saveShippingMethod($shippingMethod)) { + if ( + Cart::hasError() + || ! $shippingMethod + || ! Cart::saveShippingMethod($shippingMethod) + ) { return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403); } @@ -150,7 +172,11 @@ class OnepageController extends Controller { $payment = request()->get('payment'); - if (Cart::hasError() || ! $payment || ! Cart::savePaymentMethod($payment)) { + if ( + Cart::hasError() + || ! $payment + || ! Cart::savePaymentMethod($payment) + ) { return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403); } @@ -226,11 +252,17 @@ class OnepageController extends Controller $minimumOrderAmount = core()->getConfigData('sales.orderSettings.minimum-order.minimum_order_amount') ?? 0; - if (auth()->guard('customer')->check() && auth()->guard('customer')->user()->is_suspended) { + if ( + auth()->guard('customer')->check() + && auth()->guard('customer')->user()->is_suspended + ) { throw new \Exception(trans('shop::app.checkout.cart.suspended-account-message')); } - if (auth()->guard('customer')->user() && ! auth()->guard('customer')->user()->status) { + if ( + auth()->guard('customer')->user() + && ! auth()->guard('customer')->user()->status + ) { throw new \Exception(trans('shop::app.checkout.cart.inactive-account-message')); } @@ -246,7 +278,10 @@ class OnepageController extends Controller throw new \Exception(trans('shop::app.checkout.cart.check-billing-address')); } - if ($cart->haveStockableItems() && ! $cart->selected_shipping_rate) { + if ( + $cart->haveStockableItems() + && ! $cart->selected_shipping_rate + ) { throw new \Exception(trans('shop::app.checkout.cart.specify-shipping-method')); } diff --git a/packages/Webkul/Shop/src/Http/Controllers/ReviewController.php b/packages/Webkul/Shop/src/Http/Controllers/ReviewController.php index 59f923231..5f6fc8775 100755 --- a/packages/Webkul/Shop/src/Http/Controllers/ReviewController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/ReviewController.php @@ -33,7 +33,10 @@ class ReviewController extends Controller */ public function create($slug) { - if (auth()->guard('customer')->check() || core()->getConfigData('catalog.products.review.guest_review')) { + if ( + auth()->guard('customer')->check() + || core()->getConfigData('catalog.products.review.guest_review') + ) { $product = $this->productRepository->findBySlug($slug); if ($product == null) { diff --git a/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php b/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php index d919445a0..f3cd79e45 100755 --- a/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/SubscriptionController.php @@ -93,7 +93,11 @@ class SubscriptionController extends Controller $subscriber = $this->subscriptionRepository->findOneByField('token', $token); if (isset($subscriber)) { - if ($subscriber->count() > 0 && $subscriber->is_subscribed == 1 && $subscriber->update(['is_subscribed' => 0])) { + if ( + $subscriber->count() > 0 + && $subscriber->is_subscribed == 1 + && $subscriber->update(['is_subscribed' => 0]) + ) { session()->flash('info', trans('shop::app.subscription.unsubscribed')); } else { session()->flash('info', trans('shop::app.subscription.already-unsub')); diff --git a/packages/Webkul/Shop/src/Http/Middleware/Theme.php b/packages/Webkul/Shop/src/Http/Middleware/Theme.php index 137858659..d57c65639 100755 --- a/packages/Webkul/Shop/src/Http/Middleware/Theme.php +++ b/packages/Webkul/Shop/src/Http/Middleware/Theme.php @@ -18,7 +18,10 @@ class Theme $themes = app('themes'); $channel = core()->getCurrentChannel(); - if ($channel && $channelThemeCode = $channel->theme) { + if ( + $channel + && $channelThemeCode = $channel->theme + ) { if ($themes->exists($channelThemeCode)) { $themes->set($channelThemeCode); } else { diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php index 02cc5f633..846562632 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/cart/index.blade.php @@ -35,7 +35,7 @@ @php $productBaseImage = $item->product->getTypeInstance()->getBaseImage($item); - if (is_null ($item->product->url_key)) { + if (is_null($item->product->url_key)) { if (! is_null($item->product->parent)) { $url_key = $item->product->parent->url_key; } @@ -106,7 +106,10 @@ @if ($showWishlist) - @if ($item->parent_id != 'null' ||$item->parent_id != null) + @if ( + $item->parent_id != 'null' + || $item->parent_id != null + ) @@ -287,8 +290,9 @@ }, decreaseQty: function() { - if (this.qty > this.minQuantity) + if (this.qty > this.minQuantity) { this.qty = parseInt(this.qty) - 1; + } }, increaseQty: function() { @@ -300,6 +304,7 @@ function removeLink(message) { if (! confirm(message)) { event.preventDefault(); + return; } } @@ -321,7 +326,7 @@ if (operation == 'add') { quantity = parseInt(quantity) + 1; - } elseif (operation == 'remove') { + } else if (operation == 'remove') { if (quantity > 1) { quantity = parseInt(quantity) - 1; } else { diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php index 782969bed..309da3baf 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php @@ -218,9 +218,9 @@ if (result) { if (scope == 'address-form') { self.saveAddress(); - } elseif (scope == 'shipping-form') { + } else if (scope == 'shipping-form') { self.saveShipping(); - } elseif (scope == 'payment-form') { + } else if (scope == 'payment-form') { self.savePayment(); } } @@ -392,7 +392,7 @@ if (response.status == 422) { serverErrors = response.data.errors; this.$root.addServerErrors(scope) - } elseif (response.status == 403) { + } else if (response.status == 403) { if (response.data.redirect_url) { window.location.href = response.data.redirect_url; } diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php index 221d75386..459b4ee73 100644 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-checkout.blade.php @@ -10,7 +10,10 @@ {{ __('shop::app.customer.login-form.forgot_pass') }}
- @if (Cookie::has('enable-resend') && Cookie::get('enable-resend') == true) + @if ( + Cookie::has('enable-resend') + && Cookie::get('enable-resend') == true + ) {{ __('shop::app.customer.login-form.resend-verification') }} @endif
diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php index 4bf799254..5cdb1c395 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage/customer-info.blade.php @@ -192,7 +192,10 @@
- @if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) + @if ( + core()->getConfigData('customer.settings.address.street_lines') + && core()->getConfigData('customer.settings.address.street_lines') > 1 + )
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++)
- @if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) + @if ( + core()->getConfigData('customer.settings.address.street_lines') + && core()->getConfigData('customer.settings.address.street_lines') > 1 + )
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) @endif - @if ($cart->haveStockableItems() && $shippingAddress = $cart->shipping_address) + @if ( + $cart->haveStockableItems() + && $shippingAddress = $cart->shipping_address + )
{{ __('shop::app.checkout.onepage.shipping-address') }} diff --git a/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php b/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php index 13385f8ad..29a4e11ba 100755 --- a/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/customers/account/address/create.blade.php @@ -131,7 +131,10 @@
- @if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) + @if ( + core()->getConfigData('customer.settings.address.street_lines') + && core()->getConfigData('customer.settings.address.street_lines') > 1 + )
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) {{ $errors->first('address1.*') }}
- @if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1) + @if ( + core()->getConfigData('customer.settings.address.street_lines') + && core()->getConfigData('customer.settings.address.street_lines') > 1 + )
@for ($i = 1; $i < core()->getConfigData('customer.settings.address.street_lines'); $i++) -1) { return true; } - } elseif (type == "single") { + } else if (type == "single") { if (attributeItems == option.attribute_option_id.toString()) { return true; } diff --git a/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php b/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php index b2d347336..e16f6964d 100755 --- a/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/layouts/header/index.blade.php @@ -404,7 +404,7 @@ $('#hammenu').addClass('icon-menu'); $("#search-responsive").css("display", "block"); $("#header-bottom").css("display", "none"); - } elseif (currentElement.hasClass('icon-menu')) { + } else if (currentElement.hasClass('icon-menu')) { currentElement.removeClass('icon-menu'); currentElement.addClass('icon-menu-close'); $('#search').removeClass('icon-menu-close'); diff --git a/packages/Webkul/Shop/src/Resources/views/products/index.blade.php b/packages/Webkul/Shop/src/Resources/views/products/index.blade.php index f156165cd..cd950fb94 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/index.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/index.blade.php @@ -111,7 +111,7 @@ $('.responsive-layred-filter').css('display','none'); $('.pager').css('display','flex'); $('.pager').css('justify-content','space-between'); - } elseif (currentElement.hasClass('filter-icon')) { + } else if (currentElement.hasClass('filter-icon')) { currentElement.removeClass('filter-icon'); currentElement.addClass('icon-menu-close-adj'); currentElement.prev().removeClass(); diff --git a/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php b/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php index 11c900e91..0291c2058 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/list/card.blade.php @@ -4,7 +4,10 @@ getProductBaseImage($product); ?> - @if (! $product->getTypeInstance()->haveSpecialPrice() && $product->new) + @if ( + ! $product->getTypeInstance()->haveSpecialPrice() + && $product->new + )
{{ __('shop::app.products.new') }}
diff --git a/packages/Webkul/Shop/src/Resources/views/products/reviews/create.blade.php b/packages/Webkul/Shop/src/Resources/views/products/reviews/create.blade.php index e0156c3da..6bd3659c1 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/reviews/create.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/reviews/create.blade.php @@ -61,7 +61,10 @@ @{{ errors.first('title') }}
- @if (core()->getConfigData('catalog.products.review.guest_review') && ! auth()->guard('customer')->user()) + @if ( + core()->getConfigData('catalog.products.review.guest_review') + && ! auth()->guard('customer')->user() + )