Skip to content

Commit 4cedec8

Browse files
committed
Check if session is bound
1 parent 355bf5b commit 4cedec8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ServiceProvider.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace Barryvdh\Debugbar;
22

33
use Illuminate\Routing\Router;
4+
use Illuminate\Session\SessionManager;
45

56
class ServiceProvider extends \Illuminate\Support\ServiceProvider
67
{
@@ -29,9 +30,11 @@ public function register()
2930
$this->app->singleton('debugbar', function ($app) {
3031
$debugbar = new LaravelDebugbar($app);
3132

32-
$sessionManager = $app['session'];
33-
$httpDriver = new SymfonyHttpDriver($sessionManager);
34-
$debugbar->setHttpDriver($httpDriver);
33+
if ($app->bound(SessionManager::class)) {
34+
$sessionManager = $app->make(SessionManager::class);
35+
$httpDriver = new SymfonyHttpDriver($sessionManager);
36+
$debugbar->setHttpDriver($httpDriver);
37+
}
3538

3639
return $debugbar;
3740
}

0 commit comments

Comments
 (0)