Skip to content

Commit

Permalink
add blade directive after resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Jan 28, 2022
1 parent 74ec034 commit 9b8ed1e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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 . ') !!}';
});
});
}
}

0 comments on commit 9b8ed1e

Please sign in to comment.