From 865d0736d403998e2db31be9ea612fa27bb0f3de Mon Sep 17 00:00:00 2001 From: Abdullah Al-Faqeir Date: Wed, 6 Oct 2021 16:52:20 +0300 Subject: [PATCH] - Final CS fixes. --- .../Webkul/Core/src/Helpers/Laravel5Helper.php | 2 +- packages/Webkul/Core/src/Models/Channel.php | 18 ++++++++++-------- packages/Webkul/Product/src/Models/Product.php | 10 +++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/Webkul/Core/src/Helpers/Laravel5Helper.php b/packages/Webkul/Core/src/Helpers/Laravel5Helper.php index d8d57d5c5..a9b0934d6 100644 --- a/packages/Webkul/Core/src/Helpers/Laravel5Helper.php +++ b/packages/Webkul/Core/src/Helpers/Laravel5Helper.php @@ -259,7 +259,7 @@ class Laravel5Helper extends Laravel private function haveBookingEventProduct(array $configs = [], array $productStates = []): Product { $I = $this; - if (!in_array('booking', $productStates)) { + if (! in_array('booking', $productStates)) { $productStates = array_merge($productStates, ['booking']); } diff --git a/packages/Webkul/Core/src/Models/Channel.php b/packages/Webkul/Core/src/Models/Channel.php index a3fd16e01..8a7217955 100755 --- a/packages/Webkul/Core/src/Models/Channel.php +++ b/packages/Webkul/Core/src/Models/Channel.php @@ -8,7 +8,9 @@ use Webkul\Core\Eloquent\TranslatableModel; use Webkul\Inventory\Models\InventorySourceProxy; use Webkul\Core\Database\Factories\ChannelFactory; use Webkul\Core\Contracts\Channel as ChannelContract; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; class Channel extends TranslatableModel implements ChannelContract { @@ -43,7 +45,7 @@ class Channel extends TranslatableModel implements ChannelContract /** * Get the channel locales. */ - public function locales(): \Illuminate\Database\Eloquent\Relations\BelongsToMany + public function locales(): BelongsToMany { return $this->belongsToMany(LocaleProxy::modelClass(), 'channel_locales'); } @@ -51,7 +53,7 @@ class Channel extends TranslatableModel implements ChannelContract /** * Get the default locale */ - public function default_locale(): \Illuminate\Database\Eloquent\Relations\BelongsTo + public function default_locale(): BelongsTo { return $this->belongsTo(LocaleProxy::modelClass()); } @@ -59,7 +61,7 @@ class Channel extends TranslatableModel implements ChannelContract /** * Get the channel locales. */ - public function currencies(): \Illuminate\Database\Eloquent\Relations\BelongsToMany + public function currencies(): BelongsToMany { return $this->belongsToMany(CurrencyProxy::modelClass(), 'channel_currencies'); } @@ -67,7 +69,7 @@ class Channel extends TranslatableModel implements ChannelContract /** * Get the channel inventory sources. */ - public function inventory_sources(): \Illuminate\Database\Eloquent\Relations\BelongsToMany + public function inventory_sources(): BelongsToMany { return $this->belongsToMany(InventorySourceProxy::modelClass(), 'channel_inventory_sources'); } @@ -75,7 +77,7 @@ class Channel extends TranslatableModel implements ChannelContract /** * Get the base currency */ - public function base_currency(): \Illuminate\Database\Eloquent\Relations\BelongsTo + public function base_currency(): BelongsTo { return $this->belongsTo(CurrencyProxy::modelClass()); } @@ -83,7 +85,7 @@ class Channel extends TranslatableModel implements ChannelContract /** * Get the base currency */ - public function root_category(): \Illuminate\Database\Eloquent\Relations\BelongsTo + public function root_category(): BelongsTo { return $this->belongsTo(CategoryProxy::modelClass(), 'root_category_id'); } @@ -93,7 +95,7 @@ class Channel extends TranslatableModel implements ChannelContract */ public function logo_url() { - if (!$this->logo) { + if (! $this->logo) { return; } @@ -113,7 +115,7 @@ class Channel extends TranslatableModel implements ChannelContract */ public function favicon_url() { - if (!$this->favicon) { + if (! $this->favicon) { return; } diff --git a/packages/Webkul/Product/src/Models/Product.php b/packages/Webkul/Product/src/Models/Product.php index ce34f2bcb..d78363575 100755 --- a/packages/Webkul/Product/src/Models/Product.php +++ b/packages/Webkul/Product/src/Models/Product.php @@ -302,7 +302,7 @@ class Product extends Model implements ProductContract $this->typeInstance = app(config('product_types.' . $this->type . '.class')); - if (!$this->typeInstance instanceof AbstractType) { + if (! $this->typeInstance instanceof AbstractType) { throw new Exception("Please ensure the product type '{$this->type}' is configured in your application."); } @@ -372,13 +372,13 @@ class Product extends Model implements ProductContract */ public function getAttribute($key) { - if (!method_exists(static::class, $key) - && !in_array($key, [ + if (! method_exists(static::class, $key) + && ! in_array($key, [ 'pivot', 'parent_id', 'attribute_family_id', ]) - && !isset($this->attributes[$key])) { + && ! isset($this->attributes[$key])) { if (isset($this->id)) { $this->attributes[$key] = ''; @@ -417,7 +417,7 @@ class Product extends Model implements ProductContract */ public function getCustomAttributeValue($attribute) { - if (!$attribute) { + if (! $attribute) { return; }