app->singleton('registry', function ($app) { $registry = new IlluminateRegistry($app, $app->make(CustomEntityManagerFactory::class)); // Add all managers into the registry foreach ($app->make('config')->get('doctrine.managers', []) as $manager => $settings) { $registry->addManager($manager, $settings); } return $registry; }); // Once the registry get's resolved, we will call the resolve callbacks which were waiting for the registry $this->app->afterResolving('registry', function (ManagerRegistry $registry, Container $container) { $this->bootExtensionManager(); BootChain::boot($registry); }); $this->app->alias('registry', ManagerRegistry::class); $this->app->alias('registry', IlluminateRegistry::class); } }