Feature: Adding Custom Fields to Products
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user