Skip to content

Commit 7fecb1d

Browse files
authored
[1.x] Give new container instance to session manager (#669)
* Give new app instance to session manager * wip
1 parent 23376a9 commit 7fecb1d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/Concerns/ProvidesDefaultConfigurationOptions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public static function prepareApplicationForNextOperation(): array
4242
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToNotificationChannelManager::class,
4343
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToPipelineHub::class,
4444
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToCacheManager::class,
45+
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToSessionManager::class,
4546
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToQueueManager::class,
4647
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToRouter::class,
4748
\Laravel\Octane\Listeners\GiveNewApplicationInstanceToValidationFactory::class,
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Laravel\Octane\Listeners;
4+
5+
class GiveNewApplicationInstanceToSessionManager
6+
{
7+
/**
8+
* Handle the event.
9+
*
10+
* @param mixed $event
11+
* @return void
12+
*/
13+
public function handle($event): void
14+
{
15+
if (! $event->sandbox->resolved('session')) {
16+
return;
17+
}
18+
19+
with($event->sandbox->make('session'), function ($manager) use ($event) {
20+
if (method_exists($manager, 'setContainer')) {
21+
$manager->setContainer($event->sandbox);
22+
}
23+
});
24+
}
25+
}

0 commit comments

Comments
 (0)