Feature: Adding Custom Fields to Products

This commit is contained in:
2026-09-22 21:17:01 +03:00
parent 59c57b37fc
commit 1c7efc6e4d
6 changed files with 241 additions and 5 deletions
+14 -1
View File
@@ -19,7 +19,20 @@ class CustomerServiceProvider extends ServiceProvider
{
public function boot(): void
{
ModelManifest::replace(LunarCustomer::class, Customer::class);
// Deferred to booted() — LunarServiceProvider (lunarphp/core)
// calls Facades\ModelManifest::register() from its OWN boot(),
// which re-discovers every Lunar\Models\* class and repopulates
// the whole manifest from scratch, silently undoing a replace()
// call made from a boot() that ran earlier in the provider list.
// booted() fires only once every provider's boot() has completed,
// guaranteeing this is the one that actually sticks — same fix,
// same reasoning, as Providers\CatalogServiceProvider's own
// Product replace() call. This one likely only "worked" before
// because 3dealer's own AppServiceProvider independently
// re-registers Customer correctly in its own booted() — a
// consuming app without that redundant registration would have
// silently gotten the base Lunar\Models\Customer back.
$this->app->booted(fn () => ModelManifest::replace(LunarCustomer::class, Customer::class));
Event::listen(UserCreated::class, CreateCustomerForUser::class);