diff --git a/packages/core/src/LunarServiceProvider.php b/packages/core/src/LunarServiceProvider.php index d4df153a7d..550d0a8a99 100644 --- a/packages/core/src/LunarServiceProvider.php +++ b/packages/core/src/LunarServiceProvider.php @@ -65,6 +65,7 @@ use Lunar\Models\Collection; use Lunar\Models\Currency; use Lunar\Models\CustomerGroup; +use Lunar\Models\Discount; use Lunar\Models\Language; use Lunar\Models\Order; use Lunar\Models\OrderLine; @@ -79,6 +80,7 @@ use Lunar\Observers\CollectionObserver; use Lunar\Observers\CurrencyObserver; use Lunar\Observers\CustomerGroupObserver; +use Lunar\Observers\DiscountObserver; use Lunar\Observers\LanguageObserver; use Lunar\Observers\MediaObserver; use Lunar\Observers\OrderLineObserver; @@ -298,6 +300,7 @@ protected function registerObservers(): void { Channel::observe(ChannelObserver::class); CustomerGroup::observe(CustomerGroupObserver::class); + Discount::observe(DiscountObserver::class); Language::observe(LanguageObserver::class); Currency::observe(CurrencyObserver::class); Url::observe(UrlObserver::class); diff --git a/packages/core/src/Observers/DiscountObserver.php b/packages/core/src/Observers/DiscountObserver.php new file mode 100644 index 0000000000..fa99d27596 --- /dev/null +++ b/packages/core/src/Observers/DiscountObserver.php @@ -0,0 +1,22 @@ +brands()->detach(); + $discount->collections()->detach(); + $discount->customerGroups()->detach(); + $discount->purchasables()->detach(); + $discount->users()->detach(); + } +}