File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function boot()
2929
3030 $ this ->app ->booted (function (): void {
3131 // register response macro "image"
32- if (! $ this ->app -> runningInConsole () && !ResponseFacade:: hasMacro ( Facades \Image:: BINDING )) {
32+ if ($ this ->shouldCreateResponseMacro ( )) {
3333 ResponseFacade::macro (Facades \Image::BINDING , function (
3434 Image $ image ,
3535 null |string |Format |MediaType |FileExtension $ format = null ,
@@ -63,4 +63,16 @@ public function register()
6363 );
6464 });
6565 }
66+
67+ /**
68+ * Determine if response macro should be created
69+ */
70+ private function shouldCreateResponseMacro (): bool
71+ {
72+ if (!$ this ->app ->runningUnitTests () && $ this ->app ->runningInConsole ()) {
73+ return false ;
74+ }
75+
76+ return !ResponseFacade::hasMacro (Facades \Image::BINDING );
77+ }
6678}
You can’t perform that action at this time.
0 commit comments