Fix: Turning the bind of the ShippingMethodManagerInterface to a singleton, so that it can actually resolve the shipping methods
This commit is contained in:
@@ -154,7 +154,13 @@ class ShippingServiceProvider extends ServiceProvider
|
||||
// run before the Shipping::extend() calls below, which resolve —
|
||||
// and the facade then CACHES — whatever's bound at that moment).
|
||||
$this->app->booted(function () {
|
||||
$this->app->bind(ShippingMethodManagerInterface::class, fn ($app) => $app->make(ShippingManager::class));
|
||||
// A singleton, not bind(): the queue worker clears every
|
||||
// facade's cached instance before each job
|
||||
// (Facade::clearResolvedInstances()), so with bind() the Shipping
|
||||
// facade then built a fresh, empty manager — without the drivers
|
||||
// extended below — and every queued job (tracking, voucher sync)
|
||||
// saw no carriers at all.
|
||||
$this->app->singleton(ShippingMethodManagerInterface::class, fn ($app) => $app->make(ShippingManager::class));
|
||||
|
||||
// Shipping::extend('acs', fn ($app) => $app->make(AcsRateDriver::class));
|
||||
Shipping::extend('box-now', fn ($app) => $app->make(BoxNowRateDriver::class));
|
||||
|
||||
Reference in New Issue
Block a user