diff --git a/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php b/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php index 1efa59ad1c..7e8e24bbc3 100644 --- a/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php +++ b/packages/admin/src/Http/Livewire/Components/Discounts/AbstractDiscount.php @@ -125,9 +125,6 @@ public function mount() return $this->mapProductToArray($limitation->purchasable); }); - $this->selectedBrands = $this->discount->brands->map(fn ($brand) => $this->mapBrandToArray($brand)) ?? collect(); - $this->selectedCollections = $this->discount->collections->map(fn ($collection) => $this->mapCollectionToArray($collection)) ?? collect(); - $this->selectedConditions = $this->discount->purchasableConditions() ->wherePurchasableType(Product::class) ->pluck('purchasable_id')->values()->toArray(); @@ -329,7 +326,7 @@ public function removeProduct($index) */ public function save() { - $redirect = ! $this->discount->id; + $redirect = !$this->discount->id; $this->withValidator(function (Validator $validator) { $validator->after(function ($validator) { @@ -353,8 +350,8 @@ public function save() $channels = collect($this->availability['channels'])->mapWithKeys(function ($channel) { return [ $channel['channel_id'] => [ - 'starts_at' => ! $channel['enabled'] ? null : $channel['starts_at'], - 'ends_at' => ! $channel['enabled'] ? null : $channel['ends_at'], + 'starts_at' => !$channel['enabled'] ? null : $channel['starts_at'], + 'ends_at' => !$channel['enabled'] ? null : $channel['ends_at'], 'enabled' => $channel['enabled'], ], ]; diff --git a/packages/admin/src/Http/Livewire/Components/Discounts/DiscountCreate.php b/packages/admin/src/Http/Livewire/Components/Discounts/DiscountCreate.php index 7ac8ee74fc..1cdddf7c10 100644 --- a/packages/admin/src/Http/Livewire/Components/Discounts/DiscountCreate.php +++ b/packages/admin/src/Http/Livewire/Components/Discounts/DiscountCreate.php @@ -33,6 +33,7 @@ public function mount() $this->selectedBrands = collect(); $this->selectedCollections = collect(); + $this->selectedProducts = collect(); } /**