From 9b8ed1ed02f00a0495fdeb02f916c7e73ebd9017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Fri, 28 Jan 2022 22:34:18 +0300 Subject: [PATCH] add blade directive after resolving --- src/Provider.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Provider.php b/src/Provider.php index 2d2620b..3ae47f9 100644 --- a/src/Provider.php +++ b/src/Provider.php @@ -3,8 +3,8 @@ namespace Akaunting\Apexcharts; use Akaunting\Apexcharts\Charts; -use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; +use Illuminate\View\Compilers\BladeCompiler; class Provider extends ServiceProvider { @@ -40,8 +40,10 @@ public function boot() public function registerBladeDirectives() { - Blade::directive('apexchartsScripts', function ($expression) { - return '{!! \Akaunting\Apexcharts\Charts::loadScript(' . $expression . ') !!}'; + $this->app->afterResolving('blade.compiler', function (BladeCompiler $bladeCompiler) { + $bladeCompiler->directive('apexchartsScripts', function ($expression) { + return '{!! \Akaunting\Apexcharts\Charts::loadScript(' . $expression . ') !!}'; + }); }); } }