Skip to content

Commit

Permalink
Merge branch 'release/5.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
bvlinsky committed Sep 21, 2023
2 parents 6d406cb + 0b65b68 commit 29f7be8
Show file tree
Hide file tree
Showing 125 changed files with 345 additions and 320 deletions.
2 changes: 1 addition & 1 deletion app/Casts/MetadataValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function get($model, string $key, $value, array $attributes): mixed
return match ($model->value_type->value) {
MetadataType::BOOLEAN => (bool) $value,
MetadataType::NUMBER => (float) $value,
default => $value
default => $value,
};
}

Expand Down
4 changes: 2 additions & 2 deletions app/Criteria/ProductAttributeSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public function query(Builder $query): Builder
$query
->from('product_attribute_attribute_option')
->whereRaw(
'`product_attribute`.`id` = `product_attribute_attribute_option`.`product_attribute_id`'
'`product_attribute`.`id` = `product_attribute_attribute_option`.`product_attribute_id`',
);

if (is_array($value)) {
$query->join(
'attribute_options',
'product_attribute_attribute_option.attribute_option_id',
'=',
'attribute_options.id'
'attribute_options.id',
);

$key = is_numeric(Arr::first($value)) ?
Expand Down
4 changes: 2 additions & 2 deletions app/Criteria/ProductNotAttributeSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public function query(Builder $query): Builder
$query
->from('product_attribute_attribute_option')
->whereRaw(
'`product_attribute`.`id` = `product_attribute_attribute_option`.`product_attribute_id`'
'`product_attribute`.`id` = `product_attribute_attribute_option`.`product_attribute_id`',
);

if (is_array($value)) {
$query->join(
'attribute_options',
'product_attribute_attribute_option.attribute_option_id',
'=',
'attribute_options.id'
'attribute_options.id',
);

$key = is_numeric(Arr::first($value)) ?
Expand Down
4 changes: 2 additions & 2 deletions app/Criteria/WhereHasBuyer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public function query(Builder $query): Builder
fn (Builder $query) => $query
->whereDoesntHave(
'status',
fn (Builder $query) => $query->where('cancel', '!=', false)
fn (Builder $query) => $query->where('cancel', '!=', false),
)
->whereHasMorph(
'buyer',
$this->key === 'user' ? [User::class] : [App::class],
fn (Builder $query) => $query->where('id', $this->value),
)
),
);
}
}
2 changes: 1 addition & 1 deletion app/Dtos/AttributeDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
) {}

public static function instantiateFromRequest(
AttributeStoreRequest|AttributeUpdateRequest|FormRequest $request
AttributeStoreRequest|AttributeUpdateRequest|FormRequest $request,
): self {
return new self(
id: $request->input('id', new Missing()),
Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/BannerMediaDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function fromDataArray(array $data): self
title: $data['title'] ?? null,
subtitle: $data['subtitle'] ?? null,
media: Collection::make($responsiveMedia)
->map(fn ($media) => ResponsiveMediaDto::fromDataArray($media))
->map(fn ($media) => ResponsiveMediaDto::fromDataArray($media)),
);
}

Expand Down
4 changes: 2 additions & 2 deletions app/Dtos/ConditionGroupDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ConditionGroupDto extends Dto
public static function fromArray(array $array): self
{
return new self(
conditions: self::transformArrayToConditionDtos($array)
conditions: self::transformArrayToConditionDtos($array),
);
}

Expand All @@ -39,7 +39,7 @@ private static function transformArrayToConditionDtos(array $conditions): array
ConditionType::WEEKDAY_IN => WeekDayInConditionDto::fromArray($condition),
ConditionType::CART_LENGTH => CartLengthConditionDto::fromArray($condition),
ConditionType::COUPONS_COUNT => CouponsCountConditionDto::fromArray($condition),
default => throw new Exception('Unknown condition type.')
default => throw new Exception('Unknown condition type.'),
};
}

Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/CouponDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class CouponDto extends SaleDto implements InstantiateFromRequest
protected array|Missing $metadata;

public static function instantiateFromRequest(
CouponCreateRequest|CouponUpdateRequest|FormRequest|SaleCreateRequest|StatusUpdateRequest $request
CouponCreateRequest|CouponUpdateRequest|FormRequest|SaleCreateRequest|StatusUpdateRequest $request,
): self {
return new self(
code: $request->input('code', new Missing()),
Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/MediaAttachmentDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static function instantiateFromRequest(FormRequest $request): self
name: $request->input('name'),
type: $type,
visibility: $visibility,
description: $request->input('description') ?? new Missing()
description: $request->input('description') ?? new Missing(),
);
}
}
2 changes: 1 addition & 1 deletion app/Dtos/ProductSearchDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function instantiateFromRequest(FormRequest|ProductIndexRequest $r
metadata: self::array('metadata', $request),
metadata_private: self::array('metadata_private', $request),
price_min: $request->input('price.min', new Missing()),
price_max: $request->input('price.max', new Missing())
price_max: $request->input('price.max', new Missing()),
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/ProductSetDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
* @throws DtoException
*/
public static function instantiateFromRequest(
FormRequest|ProductSetStoreRequest|ProductSetUpdateRequest $request
FormRequest|ProductSetStoreRequest|ProductSetUpdateRequest $request,
): self {
return new self(
id: $request->input('id') ?? new Missing(),
Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/ProductSetUpdateDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ProductSetUpdateDto extends Dto implements InstantiateFromRequest
private array|Missing|null $attributes_ids;

public static function instantiateFromRequest(
FormRequest|ProductSetStoreRequest|ProductSetUpdateRequest $request
FormRequest|ProductSetStoreRequest|ProductSetUpdateRequest $request,
): self {
return new self(
name: $request->input('name', new Missing()),
Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/ProductsReorderDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ProductsReorderDto extends Dto
protected array|Missing $products;

public static function instantiateFromRequest(
FormRequest|ProductSetProductReorderRequest $request
FormRequest|ProductSetProductReorderRequest $request,
): self {
return new self(
products: $request->input('products', new Missing()),
Expand Down
2 changes: 1 addition & 1 deletion app/Dtos/UserPreferencesDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function instantiateFromRequest(Request $request): self
new_localization_login_alert: $request
->input('preferences.new_localization_login_alert', new Missing()),
recovery_code_changed_alert: $request
->input('preferences.recovery_code_changed_alert', new Missing())
->input('preferences.recovery_code_changed_alert', new Missing()),
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Enums/ExceptionsEnums/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static function getCode(string $value): int
self::SERVER_ERROR,
self::SERVER_ORDER_STATUSES_NOT_CONFIGURED,
self::SERVER_PAYMENT_MICROSERVICE_ERROR => 500,
default => 422
default => 422,
};
}
}
2 changes: 1 addition & 1 deletion app/Exceptions/AuthException.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null,
bool $simpleLogs = false
bool $simpleLogs = false,
) {
parent::__construct($message, $code, $previous, $simpleLogs);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/DiscountException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DiscountException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct(
public int $code = 500,
public string $key = 'INTERNAL_SERVER_ERROR',
public array $errors = [],
public array $stack = []
public array $stack = [],
) {}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private function createValidationAttributeData(string $key, array $data): array
ValidationError::GTE => [
'field' => $data[0],
],
default => []
default => [],
};
}
}
2 changes: 1 addition & 1 deletion app/Exceptions/ItemException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ItemException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/MediaCriticalException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MediaCriticalException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/MediaException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MediaException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/OrderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class OrderException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/PackageAuthException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PackageAuthException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/RoleException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RoleException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/StoreException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function logException(): void
. '(code: ' . $this->getCode()
. '): ' . $this->getMessage()
. ' at ' . $this->getFile()
. ':(' . $this->getLine() . ')'
. ':(' . $this->getLine() . ')',
);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/WebHookCreatorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class WebHookCreatorException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/WebHookEventException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class WebHookEventException extends StoreException
public function __construct(
string $message = '',
int $code = 0,
?Throwable $previous = null
?Throwable $previous = null,
) {
parent::__construct($message, $code, $previous);
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/AttributeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function index(AttributeIndexRequest $request): JsonResource
->with(['metadata', 'metadataPrivate']);

return AttributeResource::collection(
$query->paginate(Config::get('pagination.per_page'))
$query->paginate(Config::get('pagination.per_page')),
);
}

Expand All @@ -42,7 +42,7 @@ public function show(Attribute $attribute): JsonResource
public function store(AttributeStoreRequest $request): JsonResource
{
$attribute = $this->attributeService->create(
AttributeDto::instantiateFromRequest($request)
AttributeDto::instantiateFromRequest($request),
);

return AttributeResource::make($attribute);
Expand All @@ -52,7 +52,7 @@ public function update(Attribute $attribute, AttributeUpdateRequest $request): J
{
$attribute = $this->attributeService->update(
$attribute,
AttributeDto::instantiateFromRequest($request)
AttributeDto::instantiateFromRequest($request),
);

return AttributeResource::make($attribute);
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/AttributeOptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public function index(AttributeOptionIndexRequest $request, Attribute $attribute
->with(['metadata', 'metadataPrivate']);

return AttributeOptionResource::collection(
$query->paginate(Config::get('pagination.per_page'))
$query->paginate(Config::get('pagination.per_page')),
);
}

public function store(Attribute $attribute, AttributeOptionRequest $request): JsonResource
{
$attributeOption = $this->attributeOptionService->create(
$attribute->getKey(),
AttributeOptionDto::instantiateFromRequest($request)
AttributeOptionDto::instantiateFromRequest($request),
);

return AttributeOptionResource::make($attributeOption);
Expand All @@ -56,7 +56,7 @@ public function update(Attribute $attribute, AttributeOption $option, AttributeO

$attributeOption = $this->attributeOptionService->updateOrCreate(
$attribute->getKey(),
AttributeOptionDto::instantiateFromRequest($request)
AttributeOptionDto::instantiateFromRequest($request),
);

return AttributeOptionResource::make($attributeOption);
Expand Down
Loading

0 comments on commit 29f7be8

Please sign in to comment.