Skip to content

Commit 9b8ed1e

Browse files
committed
add blade directive after resolving
1 parent 74ec034 commit 9b8ed1e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Provider.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Akaunting\Apexcharts;
44

55
use Akaunting\Apexcharts\Charts;
6-
use Illuminate\Support\Facades\Blade;
76
use Illuminate\Support\ServiceProvider;
7+
use Illuminate\View\Compilers\BladeCompiler;
88

99
class Provider extends ServiceProvider
1010
{
@@ -40,8 +40,10 @@ public function boot()
4040

4141
public function registerBladeDirectives()
4242
{
43-
Blade::directive('apexchartsScripts', function ($expression) {
44-
return '{!! \Akaunting\Apexcharts\Charts::loadScript(' . $expression . ') !!}';
43+
$this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) {
44+
$bladeCompiler->directive('apexchartsScripts', function ($expression) {
45+
return '{!! \Akaunting\Apexcharts\Charts::loadScript(' . $expression . ') !!}';
46+
});
4547
});
4648
}
4749
}

0 commit comments

Comments
 (0)