@@ -18,6 +18,11 @@ class DebugbarViewEngine implements Engine
18
18
*/
19
19
protected $ laravelDebugbar ;
20
20
21
+ /**
22
+ * @var array
23
+ */
24
+ protected $ exclude_paths ;
25
+
21
26
/**
22
27
* @param Engine $engine
23
28
* @param LaravelDebugbar $laravelDebugbar
@@ -26,6 +31,7 @@ public function __construct(Engine $engine, LaravelDebugbar $laravelDebugbar)
26
31
{
27
32
$ this ->engine = $ engine ;
28
33
$ this ->laravelDebugbar = $ laravelDebugbar ;
34
+ $ this ->exclude_paths = app ('config ' )->get ('debugbar.options.views.exclude_paths ' , []);
29
35
}
30
36
31
37
/**
@@ -38,13 +44,19 @@ public function get($path, array $data = [])
38
44
$ basePath = base_path ();
39
45
$ shortPath = @file_exists ((string ) $ path ) ? realpath ($ path ) : $ path ;
40
46
41
- if (strpos ($ shortPath , $ basePath ) === 0 ) {
47
+ if (str_starts_with ($ shortPath , $ basePath )) {
42
48
$ shortPath = ltrim (
43
49
str_replace ('\\' , '/ ' , substr ($ shortPath , strlen ($ basePath ))),
44
50
'/ '
45
51
);
46
52
}
47
53
54
+ foreach ($ this ->exclude_paths as $ excludePath ) {
55
+ if (str_starts_with ($ shortPath , $ excludePath )) {
56
+ return $ this ->engine ->get ($ path , $ data );
57
+ }
58
+ }
59
+
48
60
return $ this ->laravelDebugbar ->measure ($ shortPath , function () use ($ path , $ data ) {
49
61
return $ this ->engine ->get ($ path , $ data );
50
62
}, 'views ' );
0 commit comments