File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,11 @@ public function configurePackage(Package $package): void
23
23
{
24
24
$ package
25
25
->name ('error-solutions ' )
26
- ->hasConfigFile ()
27
- ->hasViews ();
26
+ ->hasConfigFile ();
27
+
28
+ if ($ this ->canIncludeViews ()) {
29
+ $ package ->hasViews ();
30
+ }
28
31
}
29
32
30
33
public function bootingPackage ()
@@ -39,7 +42,7 @@ public function bootingPackage()
39
42
return new SolutionProviderRepository ($ solutionProviders );
40
43
});
41
44
42
- app ()->bind (RunnableSolutionsGuard::class, fn () => new RunnableSolutionsGuard ());
45
+ app ()->bind (RunnableSolutionsGuard::class, fn () => new RunnableSolutionsGuard ());
43
46
44
47
app ()->bind (Renderer::class, function () {
45
48
$ errorRenderer = new HtmlErrorRenderer (
@@ -55,6 +58,15 @@ public function bootingPackage()
55
58
);
56
59
});
57
60
58
- View::prependNamespace ('laravel-exceptions-renderer ' , [__DIR__ .'/../resources/views ' ]);
61
+
62
+ if ($ this ->canIncludeViews ()) {
63
+ View::prependNamespace ('laravel-exceptions-renderer ' , [__DIR__ . '/../resources/views ' ]);
64
+ }
65
+ }
66
+
67
+ protected function canIncludeViews (): bool
68
+ {
69
+ // Otherwise php artisan optimize may crash
70
+ return config ('app.debug ' ) === true ;
59
71
}
60
72
}
You can’t perform that action at this time.
0 commit comments