1
1
<?php namespace Barryvdh \Debugbar ;
2
2
3
+ use DebugBar \Storage \FileStorage ;
3
4
4
5
class ServiceProvider extends \Illuminate \Support \ServiceProvider {
5
6
@@ -44,9 +45,20 @@ public function register()
44
45
$ httpDriver = new SymfonyHttpDriver ($ sessionManager );
45
46
$ debugbar ->setHttpDriver ($ httpDriver );
46
47
48
+ $ debugbar ->setStorage ($ app ['debugbar.storage ' ]);
49
+
47
50
return $ debugbar ;
48
51
});
49
52
53
+ $ this ->app ['debugbar.storage ' ] = $ this ->app ->share (function ($ app ){
54
+
55
+ $ storagePath = storage_path ().'/cache/debugbar ' ;
56
+ if (!file_exists ($ storagePath )) {
57
+ mkdir ($ storagePath , 0777 , true );
58
+ }
59
+ return new FileStorage ($ storagePath );
60
+ });
61
+
50
62
$ this ->app ['command.debugbar.publish ' ] = $ this ->app ->share (function ($ app )
51
63
{
52
64
//Make sure the asset publisher is registered.
@@ -64,6 +76,18 @@ public function register()
64
76
});
65
77
}
66
78
79
+ $ this ->app ['router ' ]->get ('_debugbar/open ' , function () use ($ app ){
80
+
81
+ $ debugbar = $ app ['debugbar ' ];
82
+ $ debugbar ->setStorage ($ app ['debugbar.storage ' ]);
83
+ $ openHandler = new \DebugBar \OpenHandler ($ debugbar );
84
+
85
+ $ data = $ openHandler ->handle (null , false , false );
86
+ return \Response::make ($ data , 200 , array (
87
+ 'Content-Type ' => 'application/json '
88
+ ));
89
+ });
90
+
67
91
}
68
92
69
93
/**
@@ -73,7 +97,7 @@ public function register()
73
97
*/
74
98
public function provides ()
75
99
{
76
- return array ('debugbar ' , 'command.debugbar.publish ' );
100
+ return array ('debugbar ' , 'debugbar.storage ' , ' command.debugbar.publish ' );
77
101
}
78
102
79
103
}
0 commit comments