diff --git a/src/Concerns/ProvidesDefaultConfigurationOptions.php b/src/Concerns/ProvidesDefaultConfigurationOptions.php index 3dcd6fef..b59a35c9 100644 --- a/src/Concerns/ProvidesDefaultConfigurationOptions.php +++ b/src/Concerns/ProvidesDefaultConfigurationOptions.php @@ -34,6 +34,7 @@ public static function prepareApplicationForNextOperation(): array \Laravel\Octane\Listeners\CreateConfigurationSandbox::class, \Laravel\Octane\Listeners\GiveNewApplicationInstanceToAuthorizationGate::class, \Laravel\Octane\Listeners\GiveNewApplicationInstanceToBroadcastManager::class, + \Laravel\Octane\Listeners\GiveNewApplicationInstanceToDatabaseManager::class, \Laravel\Octane\Listeners\GiveNewApplicationInstanceToHttpKernel::class, \Laravel\Octane\Listeners\GiveNewApplicationInstanceToMailManager::class, \Laravel\Octane\Listeners\GiveNewApplicationInstanceToNotificationChannelManager::class, diff --git a/src/Listeners/GiveNewApplicationInstanceToDatabaseManager.php b/src/Listeners/GiveNewApplicationInstanceToDatabaseManager.php new file mode 100644 index 00000000..c15b5980 --- /dev/null +++ b/src/Listeners/GiveNewApplicationInstanceToDatabaseManager.php @@ -0,0 +1,24 @@ +sandbox->resolved('db') || + ! method_exists($event->sandbox->make('db'), 'setApplication')) { + return; + } + + with($event->sandbox->make('db'), function ($manager) use ($event) { + $manager->setApplication($event->sandbox); + }); + } +}