Skip to content

Commit 0560294

Browse files
apiholivervogel
authored andcommitted
Register macro only when ResponseFactory is resolved
1 parent 3ee4b63 commit 0560294

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Intervention\Image\Laravel;
66

7+
use Illuminate\Contracts\Routing\ResponseFactory;
78
use Illuminate\Support\Facades\Response as ResponseFacade;
89
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
910
use Intervention\Image\ImageManager;
@@ -27,7 +28,7 @@ public function boot()
2728
__DIR__ . '/../config/image.php' => config_path(Facades\Image::BINDING . '.php')
2829
]);
2930

30-
$this->app->booted(function (): void {
31+
$this->app->afterResolving(ResponseFactory::class, function (): void {
3132
// register response macro "image"
3233
if ($this->shouldCreateResponseMacro()) {
3334
ResponseFacade::macro(Facades\Image::BINDING, function (

0 commit comments

Comments
 (0)