Skip to content

Commit 7001a9b

Browse files
author
Muhammed Sari
committed
Use container events
1 parent efde5d8 commit 7001a9b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/LaravelHtmxServiceProvider.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Illuminate\Support\Facades\View;
88
use Illuminate\Support\ServiceProvider;
9+
use Illuminate\View\Compilers\BladeCompiler;
910
use Mauricius\LaravelHtmx\Http\HtmxRequest;
1011
use Mauricius\LaravelHtmx\View\BladeFragment;
1112

@@ -17,9 +18,10 @@ public function boot(): void
1718
$this->bootForConsole();
1819
}
1920

20-
$this->app['blade.compiler']->directive('fragment', fn () => '');
21-
22-
$this->app['blade.compiler']->directive('endfragment', fn () => '');
21+
$this->callAfterResolving('blade.compiler', static function (BladeCompiler $blade) {
22+
$blade->directive('endfragment', static fn () => '');
23+
$blade->directive('fragment', static fn () => '');
24+
});
2325

2426
$this->app->bind(HtmxRequest::class, fn ($container) => HtmxRequest::createFrom($container['request']));
2527

0 commit comments

Comments
 (0)